\u00bbpay what you want\u00ab solution for my shop<\/a> last week, I needed to tinker a little bit to get the particular plugin working, because I do not use the product page of WooCommerce but the single view of an own custom post type to display the buy option.<\/p>\n\n\n\n\n\n\n\nThe initial position<\/h2>\n\n\n\n
Until the change, I used the following \u2013 simplified \u2013 code to display the buy button:<\/p>\n\n\n
<?php<\/span>\n$theme_id = get_field( 'woocommerce-product'<\/span> );\n$theme_product = wc_get_product( $theme_id );\n$add_to_cart_url = $theme_product->add_to_cart_url(); ?><\/span><\/span>\n<a<\/span> class<\/span>=\"add-to-cart\"<\/span> href<\/span>=\"<?php echo $add_to_cart_url; ?>\"<\/span>><\/span>\n\t<?php<\/span> _e( 'Add to Cart'<\/span>, 'fbn'<\/span> ); ?><\/span><\/span>\n<\/a<\/span>><\/span><\/code><\/div>Code language:<\/span> HTML, XML<\/span> (<\/span>xml<\/span>)<\/span><\/small><\/pre>\n\n\nI fetch the ID of the WooCommerce product from an ACF field, the product object with wc_get_product()<\/code> and after that the add to cart URL. I put the URL into a link, and that was it.<\/p>\n\n\n\nThe easiest way to use the pay what you want plugin seems to be including the add to cart template of WooCommerce. That can be done fairly easy:<\/p>\n\n\n