This file contains 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
1 - PHP | |
<?php | |
add_action( 'woocommerce_single_product_summary', 'bbloomer_show_return_policy', 20 ); | |
function bbloomer_show_return_policy() { | |
echo '<p class="rtrn">30-day return policy offered. See Terms and Conditions for details.</p>'; | |
} |
This file contains 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 | |
add_action( 'woocommerce_single_product_summary','bloomer_echo_product_date',25 ); | |
function bloomer_echo_product_date() { | |
if ( is_product() ) { | |
echo the_date('', '<span class="date_published">Published on: ', '</span>', false); | |
} | |
} | |
This file contains 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
1 - PHP | |
<?php | |
add_action( 'woocommerce_before_single_product', 'bbloomer_prev_next_product' ); | |
// and if you also want them at the bottom... | |
add_action( 'woocommerce_after_single_product', 'bbloomer_prev_next_product' ); | |
function bbloomer_prev_next_product(){ |
This file contains 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 | |
add_action( 'woocommerce_before_single_product', 'bbloomer_show_video_not_image' ); | |
function bbloomer_show_video_not_image() { | |
// Do this for product ID = 282 only | |
if ( is_single( '282' ) ) { | |
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); | |
remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); |
This file contains 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 | |
function woocommerce_quantity_input( $args = array(), $product = null, $echo = true ) { | |
if ( is_null( $product ) ) { | |
$product = $GLOBALS['product']; | |
} | |
$defaults = array( | |
'input_id' => uniqid( 'quantity_' ), |
This file contains 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
WooCommerce product add-ons are custom input fields that show on the single product page. They’re called “add-ons” as you can add a product personalization or an upsell (at a cost of course). | |
For example, you can display a text input to print something on the product. Or radio buttons to select different kinds of product upgrades. Or a checkbox to upsell gift wrapping. | |
<?php | |
/ ----------------------------------------- | |
// 1. Show custom input field above Add to Cart | |
add_action( 'woocommerce_before_add_to_cart_button', 'bbloomer_product_add_on', 9 ); |
This file contains 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 Snippet 1: Move (a.k.a. remove, then re-add) Product Upsells Under Add to Cart @ Single Product Page | |
<?php | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); | |
add_action( 'woocommerce_single_product_summary', 'woocommerce_upsell_display', 39 ); | |
?> | |
PHP Snippet 2: Change Product Upsells Output to 2 Columns @ Single Product Page | |
<?php |