You are here: Home
Support site for Tips and Tricks HQ premium products
Well I figured out something that will work. I mainly needed to be able to put the cart button in the sidebar, so for the time being I’m using this:
<?php
$product = get_post_meta( post->ID, ‘product’, true);
echo print_wp_cart_button_new($product);
?>
Then I just put the full shortcode string with all variations into the ‘product’ meta field of my post. Quick and dirty, I don’t mind that.
I used the same principle to utilize the wordpress custom meta fields to get the same result. So I have a two fields named productname and productprice that I can enter values into and it works great.
<?php $product_id = get_post_meta($post->ID, ‘productname’, true);
$product_price = get_post_meta($post->ID, ‘productprice’, true);
echo echo print_wp_cart_button_for_product($product_id, $product_price); ?>
My question now is how do I get variations, like for tshirt size?