so, I have coded a wordpress theme and integrated woocommerce with it. It has used only simple products for some time, and I was using a simple product to test codes, as it works fine. But I recently added a variation product and then, the add to cart button also gone ( variation select dropdown is there, but values are not bonded to drop down.
If anyone can give me a hint, showing what I have done wrong, that would be a big favor.
I just got the same issue and it solved when I manually entered a price for the variable products. Unfortunately I didn't find out yet why I have to enter it, even for the same value. But it fixed it.
Hope it helps !
Related
I've been browsing for 5-6 hours to get a solution to this problem and didn't manage to make it work for the solutions I found.
A thread answered by LoicTheAztec seemed to work for the guy who posted it but doesn't work for me.
Hide variable product dropdown that has a unique variation selected by default in Woocommerce
Also, it seems the problem occurred for another guy, but his situation was quite different so I can't say I have the same problem as him. If that helps: Hide dropdown with only 1 variable in Woocommerce
I've tried Loic's solution and made sure :
the code is set up in functions.php in my theme (right before "?>")
the only variant of the product is set as default on the product's page
I also tried to make the product with only one attribute but it didn't help (it already had one variant, but I deleted the other attributes to try to make it only one attribute too but didn't help)
I also tried to delete all the possible values for this attribute (even though, still I have only one variant that is set as default). That didn't help either
Here you can see how it's displayed on my product page, even with the code in my functions.php:
In Woocommerce some customers forget to select the variations or they don't know that they must select a variation first, so they keep clicking on the add to cart button but it doesn't work for them and they email me wondering why.
So, I thought of setting the first variation as default for all of the products.
I know I can do this through the admin but I cannot do this for all the products one by one, it's time consuming.
Please is there a code to add/edit to make the first variation the one selected by default?
I once were about to do the same and what i've found after searching a bit is this: https://quadlayers.com/default-product-attributes-woocommerce/
Basically he just hooks into woocommerce_before_single_product_summary and applies some logic that programmatically set the same thing you would set by going into the backend.
Beside this being maybe a good idea i finally gave up because i had to maintain an order into my variation choices and doing this would have break it for sure in the long term (imagine something like a dimension and you have it sorted, like 10,100,1000. You run the code today and it sets 10 as the default, then one day you add 5 and it is no longer correct)
Maybe you should think about giving some visual feedback to your users when they don't select the variation, that might solve the issue and actually create more internet-aware ppls around =)
Reference to woocommerce in wordpress, I've come across an annoying bug. In the MiniCart, it shows the number of items in the cart. This works fine until I use the + or - to change the quantity. If I do that, the number just becomes a spinning wheel and the cart icon no longer shows the cart items. Now, get this: IF I delete the last item in the cart, it shows the correct number of items and shows the cart contents again. Anyone have any ideas what could be causing that? Thanks in advance for any help.
Possible thing that may reason for this:
Ajax related issue
This cause due to jquery version mismatch in major case.
Cache issue
You have cache plugin then disable it and try.If browser cache then use privet window.
hoping for some help.
We use the following - Wordpress/ woo commerce /wcvendors pro. Prices for variable products are disappearing from wp engine view despite being in the product variation information. It doesn't impact every product on our site but a fair few. How it occurs is, the price is disappearing when you go in and edit the product. If we quick edit the product the price reappears. But it will dissapears again if we use the edit button. Initially the problem started because under the "Products" and "Inventory" We had checked the following setting: "Hide out of stock items from the catalog". Now this button is not ticked but it is still causing us issues.
It seems you have an error on the product page which cause the price not to be saved.
There can be some reasons, here are two I see occasioanlly:
PHP error is caused during the save, and therefore the data is lost. WordPress and WooCommerce works flawlessly together, so the first suspects are other plugins and your theme. Try first to turn off all your plugins and switch to another theme to see if this happens again. If not try to activate your theme, and recheck, and then the plugins one after the other, and check after each activation, until you find the one makes the problem.
Too many data is being saved at one time. It can be too many variations or too many custom fields. This can be fixed by changing some PHP settings. Please have a look here especially under the WPEngine note, and also check this plugin.
I think this is a weird situation. Usually Woocommerce is a normal plugin, when I install it and Voila Ecommerce ready to use. But, when I install it in my staging server, the price never appear.
I try to debug, I print out all value on $product variable. All information I need is placed in there except "price", but regular price appear. If I put "Sale Price", the price appear, ofcourse 2 prices appear, regular and sale. So the function "$product->get_price_html()" was empty. I have tried to downgrade the Woocommerce version, the result is the same. Unlucky me. You can see it on dev.skripptek.com/kulkulfarm/shop
One problem more, if I use variations, it couldn't saved.
product dashboard
I put sale price at above, and below is null.
I have to googled it, and no one have my problems. It make me stressed and crazy. Is anyone have some problem with me? Please help, it's been 3 days.
Additional information
I already debugged Woocommerce. The "price" is never filled with value when I fill the regular price in DB, but when I fill sale price, the "price" filled automaticly with value.
When I try edit product with quick edit, price is also filled with value but not if I edit directly in edit post. Maybe someone in Automattic can help me with this?
Solved
I update this description, it is solved actually see and expand the comments below. Not sure why it happen, it is just happened in my staging server but in production working fine. Maybe need reinstall the WordPress installation or not compatible with apache version or mysql version.
I'm having a similar issue. It's been working fine with the current child theme (Dazzling) until towards the end of last year.
Products with variants however are behaving correctly. It's the simple product.. if I enter a new product and regular price, it doesn't show "add to cart" and on the previous multiple product listing screen it shows as "read more". If I put a sale price in, it works.
Also, If I remove/clear the sale price that was saved previously and save again, it still has the price I cleared. It's as if wordpress/woocommerce isn't updating the product on this section. All other areas, updating seems fine.
I did a temporary workaround, until this is resolved, by adding a sale price and scheduling it in the past.
I'm seeing a few posts about this issue and starting to suspect it an woocommerce/wordpress issue after an update? I can't be certain though.