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
| add_action( 'wp_dashboard_setup', 'wp_dashboard_setup' ); | |
| function sh_dashboard_setup() { | |
| wp_add_dashboard_widget( 'wp_gf_dashboard', 'My Gravity Form', 'wp_gf_dashboard' ); | |
| } | |
| function wp_gf_dashboard() { | |
| // Make sure the scripts are loaded | |
| // https://docs.gravityforms.com/gravity_form_enqueue_scripts/ |
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 | |
| add_filter( 'woocommerce_get_checkout_url', function( $checkout_url ) { | |
| global $wp; | |
| if ( isset( $wp->query_vars ) && ! empty( $wp->query_vars['wc-api'] ) && 'jilt' === $wp->query_vars['wc-api'] && ! empty( $_GET['token'] ) ) { | |
| $checkout_url = wc_get_cart_url(); | |
| } | |
| return $checkout_url; | |
| } ); |
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 | |
| add_action( 'init', function() { | |
| if ( is_callable( 'wc_jilt' ) ) { | |
| remove_filter( 'woocommerce_checkout_fields', array( wc_jilt()->get_checkout_handler_instance(), 'move_checkout_email_field' ), 1 ); | |
| } | |
| }, 20 ); |
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
| function alter_sf_products_per_page() { | |
| // Return the number of products per page ( default: 12 ). | |
| return 8; | |
| } | |
| add_filter('storefront_products_per_page', 'alter_sf_products_per_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
| // Insert text below the Featured Products title | |
| function add_featured_text_example() { | |
| // Echo HTML | |
| echo "<p>These are definitely our best products to consider!</p>"; | |
| } | |
| add_action( 'storefront_homepage_after_featured_products_title' , 'add_featured_text_example' ); |
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
| function wc_custom_login_redirect() { | |
| // This will redirect the customer the referring url on login to WooCommerce.. | |
| $location = $_SERVER['HTTP_REFERER']; | |
| wp_safe_redirect($location); | |
| exit(); | |
| } | |
| add_filter('woocommerce_login_redirect', 'wc_custom_login_redirect'); |
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
| function custom_pre_get_posts_query( $q ) { | |
| $tax_query = (array) $q->get( 'tax_query' ); | |
| $tax_query[] = array( | |
| 'taxonomy' => 'product_cat', | |
| 'field' => 'slug', | |
| 'terms' => array( 'clothing' ), // Don't display products in the clothing category on the shop page. | |
| 'operator' => 'NOT IN' | |
| ); |
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
| function sd_custom_hide_sales_flash() { | |
| return false; | |
| } | |
| add_filter( 'woocommerce_sale_flash', 'sd_custom_hide_sales_flash' ); |
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
| function change_gravity_add_to_cart() { | |
| return 'Changed Text'; | |
| } | |
| add_filter( 'woocommerce_gforms_add_to_cart_text', 'change_gravity_add_to_cart' ); |
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 | |
| /** | |
| * Checks if the cart contains a product bundle | |
| * @return [bool] | |
| */ | |
| function cart_contains_product_bundle(){ | |
| global $woocommerce; | |
| $contains_product_bundle = false; | |
| if ( sizeof( WC()->cart->get_cart() ) > 0 ) { | |
| // if cart has items |