Created
May 9, 2018 12:52
-
-
Save Garconis/6136ef05f45bf46428e3bcdc99443110 to your computer and use it in GitHub Desktop.
WooCommerce | Add custom text to a particular product ID variation area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//hook our function to the product variation | |
add_action( 'woocommerce_single_variation', 'fs_custom_variation_text', 18 ); | |
function fs_custom_variation_text() { | |
global $product; | |
// checking if the product is the correct product id | |
if ($product->id === 454) { | |
// custom text | |
echo '<div class="product-addon"><h3 class="addon-name">Your Custom Title</h2> | |
<div class="addon-description"><p>Add whatever text or HTML that you want to.</p></div></div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment