[memb_add_to_woo_cart]
Description
Generates a POST form (with HMAC signature and nonce) that adds the listed products to the WooCommerce cart on submit, then optionally redirects, to a URL of your choice or straight to checkout.
Supports a text or image submit button with full CSS control. Each instance receives a unique auto-incrementing form ID.
Shortcode Examples
[memb_add_to_woo_cart product_ids="42"]
Multiple products straight to checkout with an image button:
[memb_add_to_woo_cart product_ids="42,67" redirect="/checkout/" button_image="/img/buy-now.png" button_text="Buy Now"]
Shortcode Parameters
product_ids
Comma-separated product IDs to add to the cart. Default: '0'.
redirect
URL to redirect to after adding (defaults to standard cart/checkout
behavior when empty). Default: ''.
button_text
Submit button text (also the image alt text when button_image is
used). Default: 'Add to Cart'.
button_image
URL of an image to use as the submit button instead of text.
Default: ''.
css_class
CSS class(es) for the submit button. Default: ''.
css_id
HTML ID for the form element (auto-generated when empty).
Default: auto (memb_add_to_cart_form_{n}).
css_style
Inline CSS for the submit button. Default: ''.
autorun
Reserved for future auto-submit functionality. Currently unused.
Shortcode Attributes
| Attribute | Value |
|---|---|
| Conditional | No |
| Nestable | No |
| Accepts formatting | No |