• 1stwebdesigns

    (@1stwebdesigns)


    I found on the Edit Product screen (in the admin) you can assign and save attributes to a product and whilst they do save, the attributes appear to refresh via ajax and are shown as blank. If you reload the page in full, the attributes come back. This happened after upgrading Woocommerce to version 3.5.1

    I have tracked this issue down to line 195 of the file includes/class-admin.php:

    global $thepostid;

    It appears that $thepostid is an integer when the edit page is first loaded, but after saving the attributes, they refresh via ajax and $thepostid is then null.

    A very quick work around which seems to work for me is to add, directly below “global $thepostid” the following:

    global $thepostid;
    if ( ! $thepostid ) {
    $thepostid = $_POST[‘post_id’];
    }

Viewing 10 replies - 1 through 10 (of 10 total)
  • goala2016

    (@goala2016)

    When I add an attribute of images to attributes, I give it to save and update, the attribute is removed and does not appear, does this also happen to you?

    goala2016

    (@goala2016)

    I have already solved it, it has included what you have indicated and it is all ok.

    Thank you!

    siteprowizard

    (@siteprowizard)

    The fix described above does not work.
    It only appears to work for the ajax saving part – but
    if you update the page after saving the attributes
    then the attribute using images or swatches will disappear

    This is a big problem and needs to be addressed – I believe it is affecting all of the variation swatches type of plugins

    Thread Starter 1stwebdesigns

    (@1stwebdesigns)

    This isn’t the case for me. With this fix, after saving the attributes they are there, and after updating the product they are still there. I tried with an image attribute too and that worked OK

    goala2016

    (@goala2016)

    This solution also works well for me.

    gmoradiez

    (@gmoradiez)

    Also worked for me, thanks!

    sakhoshdel

    (@sakhoshdel)

    no didnt work.
    1stwebdesigns is right!

    I tried this solution but didnt work. because of this problem it is around 2 weeks that I cannot update to woocommerce 3.5.1

    Please fix this problem with an update. it is very annoying and we are waiting.
    because when I downgrade to woocommerce 3.4.7 (since I have to for now), then since my db cannot be downgraded there are other problems arising.

    please please please fix this as soon as possible.

    thanks.

    lukelukeluke

    (@lukelukeluke)

    If this doesn’t work for you make sure the quote marks around post_id are straight and not curly. I copy pasted the code and it gave me curly ones which don’t work in php.

    Thread Starter 1stwebdesigns

    (@1stwebdesigns)

    Looks like the plugin has been officially updated to fix this issue

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Cannot assign attributes to a product after upgrading to Woocommerce 3.5.1’ is closed to new replies.