Open Babylon1999 opened 1 year ago
If there are no global attributes, the New Attribute panel is loaded automagically via line 60 of wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js even if there are local attributes:
$( function () { if ( ! woocommerce_admin_meta_boxes.has_local_attributes ) { $( 'button.add_attribute' ).trigger( 'click' ); } } );
It seems the intent is to open the New Attribute panel automatically by triggering the add_attribute click event only if there are no local attributes; however, if there are no global attributes, the click event is triggered even if there are local attributes, in which case the user has to click the "remove" link on the New Attribute panel in order to save changes made to existing local attributes. I believe that is the situation in which a bug exists.
Steps to reproduce the bug:
Expected behavior:
Actual behavior:
Just to add more clarity on the issue. If we try to edit an existing variable product, particularly a locally created attribute of it, we are immediately met with a screen that assumes that we're creating a New attribute, rather than editing one:
In our example, we have the Color attribute, for which we have Blue and Red as options. But what if we want to add Green?
The button to save it cannot be clicked.
The current workaround is to remove the New attribute screen below it:
And that is only when the button can be clicked:
This issue does not happen if we have some Global Attributes saved in Products > Attributes. With these present, we are shown a screen that lets us edit the Attributes right away:
This appears to be fixed in WooCommerce 7.8.0.
Prerequisites
Describe the bug
Based on the report in zd-6321021
If you try to remove all global attributes from Products > Attributes and then create a new variable product, you'll see a "New Attribute" tab open automatically in the product attribute settings, as if you clicked the "Add" button.
Link to image: https://d.pr/i/dtwNae
When there's at least one global attribute, this doesn't happen.
I'm not sure if this is a bug, it's certainly not breaking any part of the product edit page, I just thought you know about it on the off chance it is a bug so the attribute tab doesn't break silently with a future update.
Expected behavior
/
Actual behavior
/
Steps to reproduce
WordPress Environment
/
Isolating the problem