• Resolved nurulpowa

    (@nurulpowa)


    Ciao ragazzi! Prima di tutto complimenti, i vostri prodotti sono fenomenali. (Ora continuo in inglese in caso dovesse essere utile ad altri).

    I would really need a help from you on a feature I’m working on. So basically, I have an addon of type labels and in the description I have placed a shortcode (for which I had to edit a line on one of your plugin files). The shortcode is needed for the customer to select their nearest store by entering their postcode.

    Image here: https://imgur.com/a/Xv8nQzD

    Now, what I am trying to do is to change the variation value to the name of the store selected. Because once the user add the product to the cart, the variation is the title of the field (in this case ‘Test’) and it stays like that on the checkout page and emails.

    Image here: https://imgur.com/a/xdSzZyB

    It would be really helpful if you could give me a hint on which file should I insert my custom code in order to change the variation value programmatically.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    We hope you’re doing well 😀

    In this case you should save the value the customer use in the selector in order to retrieve the information and replace the value.

    The section where our plugin add the label and value in the cart is in

    /includes/class-yith-wapo-cart.php on get_item_data() method.

    Maybe it’s possible to leave a filter on the cart data in order you can change the value

    $cart_data[] = array(
    		 'name'    => $key,
    		'display' => $value,
    	     );

    Do you have the information of the user selection at this level? we think in this way you can get your goal and change the display value

    We hope it helps you.

    Please, check it and let us know.

    Thread Starter nurulpowa

    (@nurulpowa)

    Hi Carlos,

    Thanks a lot for your help. I was able to achieve the goal by changing the display value with the value selected by the user.

    In addition to that, even the order_item_meta() method needed some custom code in order to display the correct value in the thank you page, email and admin page.

    Carlos thanks again for your guidance, it was the exact information I was looking for.

    Plugin Support Andrea Grillo

    (@agengineering)

    Hi there,

    seems a big of this version, we scheduled to release the version 2.2.5 today.
    This new version include a fix for this issue.

    Please, make a test after update and let me know if this solve the problem.

    Thanks.

    • This reply was modified 2 years, 6 months ago by Andrea Grillo.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Programmatically change variation’ is closed to new replies.