使い方
To add an ‘Add to Cart’ button for a product, simply add the shortcode [wp_cart_button name=”PRODUCT-NAME” price=”PRODUCT-PRICE”] to a post or page next to the product. Replace PRODUCT-NAME and PRODUCT-PRICE with the actual name and price.
To add the ‘Add to Cart’ button on the sidebar or from other template files use the following function: Replace PRODUCT-NAME and PRODUCT-PRICE with the actual name and price.
To add the shopping cart to a post or page (eg. checkout page) simply add the shortcode [show_wp_shopping_cart] to a post or page or use the sidebar widget to add the shopping cart to the sidebar. The shopping cart will only be visible in a post or page when a customer adds a product.
Using Product Display Box
Here is an exmaple shortcode that shows you how to use a product display box.
[wp_cart_display_product name=”My Awesome Product” price=”25.00″ thumbnail=”http://www.example.com/images/product-image.jpg” description=”This is a short description of the product”]
Simply replace the values with your product specific data
Using a compact shopping cart
Add the following shortcode where you want to show the compact shopping cart:
[wp_compact_cart]
Using Shipping
To use shipping cost for your product, use the “shipping” parameter. Here is an example shortcode usage: [wp_cart_button name=”Test Product” price=”19.95″ shipping=”4.99″]
or use the following php function from your wordpress template files
Using Variation Control
To use variation control use the variation parameter in the shortcode: [wp_cart_button name=”Test Product” price=”25.95″ var1=”VARIATION-NAME|VARIATION1|VARIATION2|VARIATION3″]
example usage: [wp_cart_button name=”Test Product” price=”29.95″ var1=”Size|small|medium|large”]
To use multiple variation for a product (2nd or 3rd variation), use the following:
[wp_cart_button name=”Test Product” price=”29.95″ var1=”Size|small|medium|large” var2=”Color|red|green|blue”]
[wp_cart_button name=”Test Product” price=”29.95″ var1=”Size|small|medium|large” var2=”Color|red|green|blue” var3=”Sleeve|short|full”]