Tyler Hall Tech Custom Snippets (copy)

// Custom PHP Code by Tyler (TITLE) function page_title_sc( ){ return get_the_title(); } add_shortcode( ‘page_title’, ‘page_title_sc’ ); // Enable Shortcode Execution in Text Widgets add_filter( ‘widget_text’, ‘do_shortcode’ ); // Disable Gutenberg Editor (use Classic Editor) add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 5); add_filter(‘use_block_editor_for_post’, ‘__return_false’,…Continue reading

Add empty cart class to Body

add_filter(‘body_class’, ‘stw_add_cart_status_class’); function stw_add_cart_status_class($classes) { if (function_exists(‘WC’)) { $cart = WC()->cart; if (isset($cart) && is_callable(array($cart, ‘get_cart_contents_count’))) { $items = $cart->get_cart_contents_count(); $classes[] = $items?’cart_has_items’:’cart_is_empty’; } } return $classes; }Continue reading

Third Party – Cart Mods

function filter_woocommerce_cart_item_class( $string, $cart_item, $cart_item_key ) { // Get the product categories slugs for this item $term_slugs = wp_get_post_terms( $cart_item[‘product_id’], ‘product_cat’, array( ‘fields’ => ‘slugs’ ) ); // NOT empty if ( ! empty ( $term_slugs ) ) { $string…Continue reading

Third Party Invoice List Page

//shortcode for total of items in cart – no shipping/taxes/etc. add_shortcode( ‘quote-total’, ‘get_quote_total’ ); function get_quote_total(){ $total = WC()->cart->total; return wc_price($total); }Continue reading

Third Party Shipping Methods

//Change “shipping” to “Express Shipping” /* * add_filter( ‘woocommerce_shipping_package_name’, ‘custom_shipping_package_name’ ); function custom_shipping_package_name( $name ) { if ( current_user_can( ‘um_third-parties’ ) ) { return ‘Express Shipping’; } } */ // Remove shipping method title add_filter( ‘woocommerce_cart_shipping_method_full_label’, ‘bbloomer_remove_shipping_label’, 9999, 2 );…Continue reading

3rd Party Checkout Page Change 1

//Change the ‘Billing details’ checkout label to ‘Contact Information’ function wc_billing_field_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case ‘Billing details’ : $translated_text = __( ‘Credit Card Address’, ‘woocommerce’ ); break; } return $translated_text; } function custom_override_checkout_fields(…Continue reading