WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Automatically add an item to cart
- AuthorPosts
- 8 March, 2015 at 5:30 pm #8266
Hello,
I´ve got a problem. I need some code for automatically add to cart.E.g.:
I want buy a pizza. When I add a pizza to cart, program automatically adds the package to cart. When I want buy 2x pizza, program automatically adds the 2x package to cart…package = item with price, etc.
—
I am looking for some like [wppizza type=’add_item_to_cart_button’ id=’6′] but without button and automatically
—Thanks for help and sorry for my English.
8 March, 2015 at 5:30 pm #8270php or javascript ?
8 March, 2015 at 6:47 pm #8272php
8 March, 2015 at 7:41 pm #8278at the moment you’d have to take/copy
wppizza/ajax/get-json.php
and use the whole bit
$options=$this->pluginOptions; /* you might want to / have to change the above to $options=get_option('wppizza'); **/ global $blog_id; /**************************************************************** * [add / remove item from cart session] ***************************************************************/ if(isset($_POST['vars']['type']) && (($_POST['vars']['type']=='add' || $_POST['vars']['type']=='remove' || $_POST['vars']['type']=='removeall' || $_POST['vars']['type']=='increment') && $_POST['vars']['id']!='') || $_POST['vars']['type']=='refresh' || $_POST['vars']['type']=='wppizza-update-order'){ /**code**/ }
and pass the relevant variables to it as the whole thing is only only available via ajax
one day i might make that whole thing into it’s own class, but for the moment it is what it is
- AuthorPosts
- The topic ‘Automatically add an item to cart’ is closed to new replies.