add_action woocommerce_after_add_to_cart_form - example - Jagrav Education
BANNER 728X90

Tuesday, September 22, 2020

add_action woocommerce_after_add_to_cart_form - example

 



Description 

To run the hook, copy the example below.

// woocommerce single catalog product extra text add
// run the action 

// Run the action 
do_action( 'woocommerce_after_add_to_cart_form' ); 
The following example is for adding a hook callback.

// // define the woocommerce_after_add_to_cart_form callback 
// run the action 

function robin_after_add_to_cart_btn(){
echo '<br/><span style="color:#fff;background: #589d3e;padding: 2px 6px;border-radius: 2px;"> Brand Fulfilled</span>
This product would be shipped directly from our store or vendor.<br/>';
echo '<br/><span style="color:#fff;background: #589d3e;padding: 2px 6px;border-radius: 2px;"> Brand Fulfilled</span>
FREE DELIVERY<br/>';
echo '<br/><span style="color:#fff;background: #589d3e;padding: 2px 6px;border-radius: 2px;"> Brand Fulfilled</span>
FREE CASH ON DELIVERY<br/>';
echo '<br/><img src="your_image link/buyer-protection.png"><span style="color:black;"> 100% Buyer Protection, 6 Days Easy Return/Exchange policy.</span><br/><br/>';

}

// Add the action 
add_action( 'woocommerce_after_add_to_cart_form', 'robin_after_add_to_cart_btn' );
// remove the action 
remove_action( 'woocommerce_after_add_to_cart_form', 'robin_after_add_to_cart_btn' )

Sample of output


No comments:

Post a Comment

Divi read more Text replace with custom text in divi builder via JS Query simple code in wordpress

  use simple JS Query for replace text  <script type="text/javascript"> (function($) { $(document).ready(function() { var ne...