• Resolved austinisaprogrammer

    (@austinisaprogrammer)


    Hello all,


    Hoping someone can help me out here. I am POSTing product/attribute/variant data to Woo – everything works for the most part except I have to manually go into Woo and click “Save attributes” for them to actually apply and be usable for variants / purchasable on the store. I have tried EVERYTHING that I’ve seen documented for values to pass in via the API, triple checking everything – as far as I see I’m doing everything correct.


    Is there some setting or something else interfering I’m not aware of? Is this bugged? Has anyone else ran into this? I appreciate any insight anyone can provide. Does this require PHP scripts to get working?


    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @austinisaprogrammer,

    I can see what you mean here. You are creating products, attributes, and variants through the REST API and everything appears to be created, however the attributes only become usable after manually clicking “Save attributes” in the WooCommerce product editor.

    Under normal circumstances, that manual step should not be required when the attributes are sent correctly via the API. WooCommerce usually saves them automatically when the product request includes the proper attribute structure.

    When creating or updating a product via the API, make sure the attributes are passed with the correct flags, especially variation and visible, for example:

    • variation: true so WooCommerce knows the attribute will be used for variations
    • visible: true so it is stored and usable
    • options containing the attribute values

    You can review the expected structure in the official REST API documentation here:
    https://woocommerce.github.io/woocommerce-rest-api-docs/#products

    Also worth confirming:

    1. The attributes are attached to the parent product before creating variations.
    2. The variation requests reference the same attribute name or ID used on the parent product.
    3. The product update request completes successfully without validation errors.

    If possible, feel free to share a sample of the API payload you are sending when creating the product and attributes. You can paste it via https://pastebin.com or https://gist.github.com and we can take a closer look at the structure.

    Looking forward to helping you get this working.

    duncan6767

    (@duncan6767)

    I have the same problem. i can share my php codes. everything is clear as you say. all of them are correct.

    • variation: true so WooCommerce knows the attribute will be used for variations
    • visible: true so it is stored and usable
    • options containing the attribute values

    I was using same php files during 3 months. everything ws working amazing till new woocommerce updates. but not unfortunately woocommerce rest api is not creating attiribitues. becasuse of this problem, variants are empty(null). how many updates woocommerce had in this month to solve this problem but unfortunately nothing happened. I read on a few forums that some people uninstalled and re-installed woocommerce and bug disappeared. I want to try but all other plugins should be deleted firstly to delete woocommerce. but unfortunately paypal for woocommerce plugin can not be deleted also! 10 times i tried to delete paypal for woocommerce but “deleting” is stable forever. you can see by photo. https://hizliresim.com/mlcdslt

    Plugin Support Frank Remmy (woo-hc)

    (@frankremmy)

    Hi @duncan6767,

    Thank you for sharing these details and your experience with the REST API attributes issue after recent WooCommerce updates. It’s clear you’ve been thorough with your PHP code, setting the attributes with the correct flags.

    To follow the forum guidelines, please open a new topic with your issue: https://ww.wp.xz.cn/support/forum-user-guide/faq/#i-have-the-same-problem-can-i-just-reply-to-someone-elses-post-with-me-too.

    In the meantime, try uninstalling both WooCommerce and PayPal (don’t worry your data won’t be deleted) and reinstalling them. To be safe, try it in a staging environment first. If that doesn’t help, please share in that thread.

    I hope that helps. Let us know if you need anything else.

    duncan6767

    (@duncan6767)

    okay. i will create new topic now. but you also have to read articles carefully. you are telling me that i should uninstall paypal. i was telling paypay can not be deleted! it is also not working.

    • This reply was modified 3 months ago by duncan6767.

    Hi @duncan6767,

    Thanks for pointing out the mix up and for clarifying the situation. I can see that you already mentioned the PayPal plugin cannot be deleted and that is an important detail.

    To make sure your case gets the proper attention and troubleshooting, please create a new topic and include the details you shared earlier about the plugin not deleting and the behavior you are seeing. Once the new thread is opened, one of our support team members will take a closer look and guide you further.

    You can open the new topic here: https://ww.wp.xz.cn/support/plugin/woocommerce/#new-topic

    Looking forward to helping you get this sorted.

    Plugin Support Ejay F – a11n

    (@ejayfernandes)

    Hi there,

    Since there’s been no recent activity on this thread, I’m marking it as resolved. Don’t hesitate to start a new thread if you need help in the future.

    If you have time, we’d be grateful for a review: https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/new-post

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.