WooCommerce Official Shortcodes
Execute a PHP function in a form post
This explains how to add custom data to the cart. Maybe useful.
This is a plugin that allows an easy button to a WC item. Maybe use this in conjunction with dynamically creating WC products
This explains how to dynamically add a WC product. Maybe set the SKU as the listing ID to keep things in order and synced.
These explain how to add products to the cart. Here’s a couple things that need to be done.
- Before adding an item to the card, clear the cart first. Otherwise the cart will just build over time of they don’t complete the sale.
- Add the service fee before the item being reserved. The serice fee is product # 3127
Test Buttons Go Here
Ad Reserve Yes/No = _get_post_meta($post_id, ‘_field_3062’, true);
Ad Stock Quantity = get_post_meta($post_id, ‘_field_3063’, true);
WC Stock Quantity = get_post_meta($wc_product_id, ‘_stock’, $stock, true);
This button will test this item
10oz jar of Tomato Sauce
post_id = 2354
wc_product_id = 3118
The WooCommerce SKU will match the ad post ID
The stock quantity will be set when an ad is created, when it’s edited and any time it’s reserved.
View Cart to Check Things
This is the shortcode