So I need to include an add to cart button on a cms page so I'm trying to do this through a template block file in php. I can't figure out how to do this for just one static product though.
So the code for the usual add to cart button on product pages looks like this:
<?php $_product = $this->getProduct(); ?> <?php $buttonTitle = $this->__('Add to Cart'); ?> <?php if($_product->isSaleable()): ?> <div class="btn-add-box"> <button type="button" title="<?php echo $buttonTitle ?>" class="btn btn-warning add-to-cart" style="margin-top:6px;width:200px;margin-left:20px;" data-url="<?php echo $this->getAddToCartUrl($_product, ['_secure' => true]) ?>" onclick="ga('ec:setAction', 'add'); ga('send', 'event', 'UX', 'click', 'add to cart');"><span><span><?php echo $buttonTitle ?></span></span></button> <?php echo $this->getChildHtml('', true, true) ?> </div> <?php endif; ?>
But how do I do this for just the product with the ID 33? So I only want to display an add to cart button that adds the product with this ID on a static page. I've tried using a url on the cms page so like http://testing.co.uk/checkout/cart/add?product=&qty= but this goes to the cart, but doesn't add the product.