I am trying to add a custom button “Buy On Ebay” displayed below the “BUY” now button on WooCommerce this should be included for every product loop linked to a custom field vendor_url
in the back end so that I can specify each product with its own external link.
1st effort
vendor_url
is the only custom variable needed.2nd effort
Simplified
Front End: ‘Buy on Ebay’ button next to “Buy” button on Woocommerce.
Backend: vendor_url = 'Ebay Product URL'
Any help would be appreciated.
If you want to use advanced custom field plugin, use the plugin and create the field for the vendor_url in every product back end. Please check the documentation of the advanced custom field plugin for creating the new field.
The next step, to display the 'Buy on Ebay' button in product page front end, open the woocommerce folder ->templates ->single-product->add-to-cart. In add-to-cart folder you can see different templates for product type. If your product type is simple, open the simple.php and you can see the add to cart button code. Below this code you can create your 'Buy on Ebay' button.
<button type="submit" class="button alt">
<?php the_field('vendor_url'); ?></button>
Note: use the key which used to create field for vendor_url.