vendredi 29 avril 2016

Woocommerce - add custom products to card from plugin

i stuck on trying to adding a customized product to the wordpress card.

I made a calculator form plugin for wordpress to calculate the cost for printing stickers.

Now i just want to be able to put the post data from my calculator form combined as a string into the the woocommerce shopping cart

So if someone filled up the calculator and is happy about the settings he/she made. the submitted form gets processed to a string with all important information $string = "StickerCount=".$_POST['sticker_count']."StickerWidth=".$_POST['sticker_width']."StickerHeight=".$_POST['sticker_height'];

and then this string should be added to the woocommerce shopping card so the user sees the string there and can proceed to checkout.

__ I already tried to make a general product called sticker and add some custom data to it. but it did not work. i used global $woocommerce; $woocommerce->cart->add_to_cart(20); // 20 is the product id and then i somehow wanted to alter meta data or something. __

Actually i just want to create a string from what i ve gotten from my plugins table and then check it out with woocommerce.

best wishes, James R.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire