Y
Y
Yuri Yanin2018-09-07 13:07:00
WordPress
Yuri Yanin, 2018-09-07 13:07:00

How to add product code to guest session on Woocommerce?

I have a separate handler file that processes the photos attached by the script, uploads them to wordpress media and receives links, then these links form a string with a separator and are pushed into the $imgurlfor variable. Next I use $woocommerce->cart->add_to_cart( 83, 1, 0, array(), array( 'imagenamed' => $imgurlfor ) );
While I am authorized, everything works fine, I parse this parameter into parts in the formation of a letter and everything is super. But if you visit the site as a guest, then the product is simply not added to the cart. She is empty. I understand that it's about sessions, but I still couldn't figure out how to add a product to a guest's session. Any ideas?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question