I have a WooCommerce store that has products with attributes that are associated with variations. When I save products, the attributes disappear (and therefore the associated variations do, too). When I re-add the attributes and save the product again, the variations come back as they were. (Note that this means attributes don’t always disappear - only when they’re not manually added before saving. )
No errors are logged.
I'm looking for some insight as to why this would happen.
I had the same issue since I use Ozisti theme for my site, too.
The workaround was to do NOT USE "Save attributes" button on product page. To save attributes changes USE "Update" (product page - on the top/right of the page).
The problem has been solved with Ozisti ThemeREX support team. They sent me new files:
wp-content/plugins/trx_addons/components/api/woocommerce/woocommerce-extended-attributes.php
wp-content/plugins/trx_addons/includes/plugin.wp.php
and now it works fine.
Regards, Jacek
I think I had a similar problem.
WordPress 5.1.1
WooCommerce 3.5.7
Ozitsi 1.0.2 Theme by ThemeRex (here was the problem)
Solution summary: Add attribute, add options, press SAVE ATTRIBUTES (attribute row folds) -> UNFOLD IT immediately - if you don't see options inserted a second ago into the Comboselect field read on.
In my case plugin ThemeREX Add-ons (shipped with Ozisti theme) was the issue. It added extra attribute types, so I could turn variations between dropdown select, image, color and button types.
After few hours of debugging I noticed that when attribute was set to one of the new types, UPDATING PRODUCT did erase all added attributes -> and by extension variations.
After ADDING ATTRIBUTES again (without SAVE ATTRIBUTES button - just adding attributes and UPDATING product) all was back in place.
Notice: when you SAVE ATTRIBUTES the row with options closes, the variations become available. But when I opened the attribute row after all AJAX saving was done it turned out that there were no OPTIONS placed in this Wordpress combo select of attribute I just edited.
So on UPDATING PRODUCT WooCommerce saved empty attribute options into DB.
This might not be perfect solution but I solved this by modifying WooCommerce's meta-boxes-product.js
I commented out line 465 and added another line to close the row:
$( '.product_attributes' ).html( response.data.html );
$( '.product_attributes .woocommerce_attribute.open .handlediv' ).trigger('click');
I didn't trace everything to the roots but makinkg it work for this single project is good enough for me at this point.
You probably use other plugins then me, but maybe they do something similar to my case.
So try to SAVE ATTRIBUTES and then immediately open attribute row again and check if selected options are inserted.. if not.. try my solution.
This Happen to me This Year. I was debugging my store for 3 days.
Solution:
I load a css file on Wordpress back office with these lines:
.save_attributes, .save-variation-changes {
display:none !important;
}
This makes WooCommerce Hide 2 buttons.
Save Attribute and Save Variation. So clients will be forced to use the update button in the product page. I'm still not sure if this is a Woocommerce bug or other plugin but for some reason, if I pressed one of these 2 buttons I would lose all my variations.
I have similiar solution with #Maciej Dejewski using Woocommerce v3.6.5.
On file /plugins/woocommerce/assets/js/admin/meta-boxes-product.js or /plugins/woocommerce/assets/js/admin/meta-boxes-product.min.js (depends on your admin page calling the javascript - you can check it via inspect element)
But instead adding line
$( '.product_attributes .woocommerce_attribute.open .handlediv' ).trigger('click');
Just commented out this
$( '.product_attributes' ).html( response.data.html );
Working fine for me
Here's the screenshot
Hope this would help!
After debugging for a hour, it turns out that my variations only disappear when not each attribute is selected. However, some of my product's attributes have between 10 and 150 entries..so that is the downside when using this method.
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:
I have been working with wp for a while now but just ran into a bug, that I can not fix with the information found in the internet.
I was editing a acf field. When I was finished writing into one of the fields, I mistakenly pressed enter. The page started reloading and all fields were gone. When going to the frontend, everything is displayed properly.
I tried to reactivate my ACF fields via the screen options what did not work. I inserted some code lines into my functions.php. or into the input.css because I thought maybe the right checkbox for the ACF fields to be displayed was missing. Nothing helped. Is there any other way to fix this issue.
thx in advance
greetings
I just come through this problem : for one of my field group, the fields box just disappeared at some point and I had no way no retrieve it thanks to the Wordpress Admin interface.
I don't know the reason why, but it appears that in my case, ACF registered some "unwanted" user meta in my database. (how is the question)
If you look inside your DB at the usermeta table content you will probably find some ACF entries like : metaboxhidden_acf-field-group or closedpostboxes_acf-field-group and maybe others...
The one causing trouble for me was meta-box-order_acf-field-group : I simply deleted the entry (but you can try editing it to remove the reference of your "lost" box) and the problem was solved.
Maybe too late to help you, but hope it can still help someone !
##EDIT##
Seems I may have a clue about how the box disappeared
Steps to reproduce :
Create a field group and associate it with whatever post type you have
Go create a whatever post (note : the Gutenberg editor is active on this edit page)
You should find your fields group at the bottom of the page
Try to move the group meta box above the Gutenberg editor (without success because it seems not possible)
Save your post
Come back to the edit page of the field group and refresh it
Tadaaa ! the fields group box is not available anymore
Go to your database, the usermeata table, you will find the entry causing the trouble again : meta-box-order_acf-field-group = a:3:{s:4:"side";s:32:"submitdiv,acf-field-group-fields";s:6:"normal";s:57:"acf-field-group-locations,acf-field-group-options,slugdiv";s:8:"advanced";s:0:"";}
I solved the problem by adding a custom script for the ACF with delete class closed on #acf-field-group-fields:
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelector('#acf-field-group-fields').classList.remove('closed');
});
I need to display the "add to cart button" without choosing default selection values with variations.
A customer can select the variable from the dropdown variations and reset the values back and the "single_variation_wrap" should always be visible.
I tried to remove "display:none" under variables.php but it didn't do the trick.
Could anyone help?
See the answer here
"WooCommerce: always showing add-to-cart button even before variation is selected"
This should work:
You can deregister the current add to cart variation Javascript, copy and paste this script into your theme directory and enqeue this new one. Here you can remove the slidedown feature and it will always show.
Caveat
When woocoomerce push a new release, you will have to check the changlog to see if anything has changed inside add-to-cart-variation.min.js
I am writing an addon for the WooCommerce plugin for Wordpress that allows product imports from an excel spreadsheet. All the products import just fine, but I am having trouble updating the layered navigation in the store sidebar. Each item has a manufacturer assigned to it on import and the manufacturer attribute is being set just fine. However, the layered navigation is not being updated - in fact it doesn't even show up unless I manually update an item.
After doing some digging, it looks like the layered navigation uses an option from wp_options called _transient_wc_ln_count_(hash) to store the count/ids of the items with that attribute. I think this is what I need for my script to work properly, but I can't find any documentation/examples about it. I'm hoping there is just a function that I can call to update the transient options. Can someone point me in the right direction?
So I never figured out the exact answer to this question, but I found something that works. After using wp_insert_post to initially add the post, and then inserting the post meta (including the manufacturer meta) with the resulting post ID, I am calling the wp_update_post function which triggers all the automatic update functions for that item, including the transient count issue. Now my product manufacturer count in the sidebar is correct. Hope this helps someone else!
After the upload you can simply call delete_transient( 'wc_attribute_taxonomies' );
That's where the transients are created: http://oik-plugins.eu/woocommerce-a2z/oik_api/wc_get_attribute_taxonomies/
See also: https://wordpress.stackexchange.com/questions/119729/create-attribute-for-woocommerce-on-plugin-activation
I'm working with Drupal 6 to create a feed collecting site. I import the original feeds via the feeds module and copy their tags. But I also want to assign a category (terms from second taxonomy) according to the author name to be able to divide the content in a unified way.
I want to use the rules module (rules-6.x-1.2) to assign these categories upon import. I use the following steps:
ON event Content is going to be saved
IF textual comparison ([node:author-name], TheAuthorName)
DO Modify node taxonomy terms (saved content, permanently, add the selected terms)
I select the terms to be added as "-none selected-" for tags and "TheCategory" for categories.
Now, when I import the feed, the category "TheCategory" is added to the content, but the tags vanish.
This happens also if I select "Replace existing terms with selected ones" or "Replace terms within same vocabulary" for the action. Upon editing, always the radio button of "add …" is selected, regardless of what I entered previously. And yes, I clicked on "save".
Is this the right way to do what I want? Why isn't it working? Could I do this with another module maybe (I don't need rules for anything else …)?
Thanks for your help!
Ok, so I found out that the right trigger to do this is "new content is created" (which I somehow couldn't get to work beforehand).
So, I ran the rules module in debug mode and found that the rule was triggered, the filter returned TRUE and the modify node taxonomy action was successfully accomplished. But the taxonomy was entirely unchanged.
I played around a little and postponed a "save content" action on the newly created content. Turns out, this fixed the problem and now everything works as I intended.
Still, there are some flaws:
I checked "permanently apply changes", but it did not do anything.
I unchecked "permanently apply changes", but upon editing again, the box was checked again (probably the setting was not saved to begin with)
The same holds true for the radio buttons for the type of "modify node taxonomy" action which was obviously not saved
Maybe this can help someone.