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 | |
// To change add to cart text on single product page | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'storemizer_single_add_to_cart_text' ); | |
function storemizer_single_add_to_cart_text() { | |
return __( 'Buy Now', 'woocommerce' ); | |
} | |
// To change add to cart text on product archives(Collection) page | |
add_filter( 'woocommerce_product_add_to_cart_text', 'storemizer_product_add_to_cart_text' ); | |
function storemizer_product_add_to_cart_text() { |
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 | |
/* Redirect user after check out */ | |
add_action( 'template_redirect', 'njengah_custom_redirect_after_purchase' ); | |
function njengah_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { |
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 | |
/** | |
* Create numeric pagination in WordPress | |
*/ | |
// Get total number of pages | |
global $wp_query; | |
$total = $wp_query->max_num_pages; | |
// Only paginate if we have more than one page |
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 | |
/** | |
* Skip Cart and Redirect to Checkout | |
* Add to functions.php of child theme | |
*/ | |
add_filter('woocommerce_add_to_cart_redirect', 'njengah_skip_cart_redirect_to_checkout_page'); | |
function njengah_skip_cart_redirect_to_checkout_page() { |
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 | |
/** | |
* Remove Plugin Update Notifications for Specific Plugin : example-plugin-folder/example-plugin-base-file.php | |
*/ | |
function njengah_remove_plugin_update_notifications($value) { | |
if ( isset( $value ) && is_object( $value ) ) { | |
unset( $value->response[ 'example-plugin-folder/example-plugin-base-file.php' ] ); |
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 | |
//Create order comments field | |
if ( version_compare( WC_VERSION, '3.0', '<' ) ) { | |
$fields = WC()->checkout->checkout_fields['billing']; | |
} else { | |
$fields = WC()->checkout->get_checkout_fields( 'billing' ); | |
} |
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 | |
/** | |
* Code Snippet should be added to the functions.php to make WooCommerce order comments required | |
*/ | |
add_action('woocommerce_after_checkout_validation', 'njengah_make_woocommerce_order_comments_required'); | |
function njengah_make_woocommerce_order_comments_required() { | |
NewerOlder