WooCommerce Official Shortcodes

https://docs.woocommerce.com/document/woocommerce-shortcodes/#section-19

Execute a PHP function in a form post

https://stackoverflow.com/questions/595358/how-can-i-execute-a-php-function-in-a-form-action

This explains how to add custom data to the cart. Maybe useful.

https://pluginrepublic.com/add-custom-cart-item-data-in-woocommerce/

This is a plugin that allows an easy button to a WC item. Maybe use this in conjunction with dynamically creating WC products 

https://wordpress.org/plugins/woocommerce-quick-buy/

This explains how to dynamically add a WC product. Maybe set the SKU as the listing ID to keep things in order and synced.

https://devnetwork.io/add-woocommerce-product-programmatically/

These explain how to add products to the cart. Here’s a couple things that need to be done.

https://www.businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/

https://quadlayers.com/woocommerce-add-to-cart-function-programmatically/#:~:text=Easy%20peasy.,cart%2D%3Eadd_to_cart(%206%20)%3B

  • 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
Your cart is currently empty.

Return to shop

Custom Shortcode

This is the shortcode

WooCommerce Official Shortcode
Quick Buy Plugin