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
/* How to Add a Quantity Field to Shop Pages in WooCommerce by Thembay */ | |
function thembay_shop_page_add_quantity_field() { | |
/** @var WC_Product $product */ | |
$product = wc_get_product( get_the_ID() ); | |
if ( ! $product->is_sold_individually() && 'variable' != $product->get_type() && $product->is_purchasable() && $product->is_in_stock() ) { | |
woocommerce_quantity_input( array( 'min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity() ) ); | |
} | |
} | |
add_action( 'woocommerce_after_shop_loop_item', 'thembay_shop_page_add_quantity_field', 1 ); |
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
add_filter( 'woocommerce_checkout_fields' , 'thembay_labels_olders', 9999 ); | |
function thembay_labels_olders( $f ) { | |
$f['order']['order_comments']['label'] = 'Change Order notes'; | |
return $f; | |
} |
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
<input id="mc4wp_email" class="form-control input-newletter" name="EMAIL" required="" type="email" placeholder="Enter your email here..."> | |
<button type="submit" value="Submit"> <span>Subscribe</span><i class="fab fa-telegram-plane"></i> </button> |
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
add_filter( 'the_title', 'shorten_woo_product_title', 10, 2 ); | |
function shorten_woo_product_title( $title, $id ) { | |
if ( ! is_singular( array( 'product' ) ) && get_post_type( $id ) === 'product' ) { | |
return substr( $title, 0, 30); // change last number to the number of characters you want | |
} else { | |
return $title; | |
} | |
} |