Skip to content

Instantly share code, notes, and snippets.

View cuocsongso's full-sized avatar

thembay cuocsongso

View GitHub Profile
@cuocsongso
cuocsongso / How to Add a Quantity Field to Shop Pages in WooCommerce by Thembay PHP file
Created December 11, 2019 06:17
How to Add a Quantity Field to Shop Pages in WooCommerce by Thembay PHP file
/* 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 );
@cuocsongso
cuocsongso / gist:66b150bb2a9598f315f29eecfc4a7cf8
Created November 14, 2019 06:40
Change Order notes (opcional)
add_filter( 'woocommerce_checkout_fields' , 'thembay_labels_olders', 9999 );
function thembay_labels_olders( $f ) {
$f['order']['order_comments']['label'] = 'Change Order notes';
return $f;
}
@cuocsongso
cuocsongso / besa_customize_footer_mobile.php
Created November 12, 2019 08:30
besa_customize_footer_mobile.php
@cuocsongso
cuocsongso / besa_customize_footer_mobile_1.php
Last active November 12, 2019 08:27
besa_customize_footer_mobile_1.php
@cuocsongso
cuocsongso / besa_footer_mobile_content_hook.php
Created November 12, 2019 08:12
besa_footer_mobile_content_hook
@cuocsongso
cuocsongso / besa-mailChimp.html
Created November 12, 2019 07:01
Besa MailChimp
<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>
@cuocsongso
cuocsongso / urna_customize_footer_mobile.php
Created November 8, 2019 08:10
urna_customize_footer_mobile
@cuocsongso
cuocsongso / urna_customize_footer_mobile_1.php
Last active November 8, 2019 08:05
Change Footer Mobile link 1
@cuocsongso
cuocsongso / urna_before_footer_mobile hook.php
Created November 8, 2019 07:51
urna_before_footer_mobile hook
@cuocsongso
cuocsongso / limit_title_woo3.php
Created October 18, 2019 07:25
Option 3: (PHP): Limit all WooCommerce product titles to max number of 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;
}
}