oc-shopaholic / oc-shopaholic-plugin

🛍️ No. 1 e-commerce platform for October CMS
https://shopaholic.one
GNU General Public License v3.0
425 stars 52 forks source link

Add items to cart #92

Closed matthewborgcarr closed 6 years ago

matthewborgcarr commented 6 years ago

Can someone please shed some light on how to add items to the cart please??

The documentation says: $.request('Cart::onAdd', { 'data': data, 'update': {'cart-items': '.cart-item-wrapper'} });

how to call this exactly?

Thanks Matthew

kharanenka commented 6 years ago

Hi @matthewborgcarr!

You can see example of using Cart component in code of demo theme.

You can install local copy of demo site and study code of demo theme.

For example: https://github.com/lovata/oc-shopaholic-demo-theme/blob/master/themes/shopaholic-demo/assets/js/main.js#L41

aarjona1991 commented 4 years ago

Hi! i want to know how can i add extra 'inputs' to the order. By default the plugin add these:

const cartData = [ { 'offer_id': form.find('input[name="offer_id"]').val(), 'quantity': form.find('input[name="quantity"]').val(), } ];

In fact i want to add the properties selected. For example 'color', 'size', etc. How can i do that? Thanks in advance!! :)

kharanenka commented 4 years ago

Hi @aarjona1991! You can find an example here.

aarjona1991 commented 4 years ago

@kharanenka Thanks a lot!!! Just what i needed!!