// Hide Woocommerce Prices on the Shop and Category Pages add_filter( 'woocommerce_get_price_html', 'woocommerce_remove_price'); function woocommerce_remove_price($price){ return ; } // Rename Woocommerce "Add to cart" and "Place order" text add_filter('gettext', 'translate_strings'); add_filter('ngettext', 'translate_strings'); function translate_strings($translated) { $translated = str_ireplace('Add to cart', 'Add to enquiry', $translated); $translated = str_ireplace('Place order', 'Request a quote', $translated); return $translated; } // Skip Woocommerce cart page and redirect to checkout add_action('template_redirect', 'wpsh_skip_cart'); function wpsh_skip_cart() { // If is cart page, redirect checkout. if( is_cart() ) wp_redirect( WC()->cart->get_checkout_url() ); } // Disable all Woocommerce payment gateways add_filter( 'woocommerce_cart_needs_payment', '__return_false' ); // Remove Woocommerce checkout fields add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { // unset($fields['billing']['billing_first_name']); // Billing First name // unset($fields['billing']['billing_last_name']); // Billing Last name // unset($fields['billing']['billing_company']); // Billing company unset($fields['billing']['billing_address_1']); // Billing Address 1 unset($fields['billing']['billing_address_2']); // Billing Address 2 unset($fields['billing']['billing_city']); // Billing city unset($fields['billing']['billing_postcode']); // Billing postcode // unset($fields['billing']['billing_country']); // Billing country unset($fields['billing']['billing_state']); // Billing state // unset($fields['billing']['billing_phone']); // Billing phone // unset($fields['billing']['billing_email']); // Billing email // unset($fields['order']['order_comments']); // Order comments return $fields; } // Add "Remove item" option to checkout add_filter( 'woocommerce_cart_item_name', 'wpsh_checkout_remove_item', 10, 3 ); function wpsh_checkout_remove_item( $product_name, $cart_item, $cart_item_key ) { if ( is_checkout() ) { $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); $remove_link = apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '×', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ), esc_attr( $product_id ), esc_attr( $_product->get_sku() ) ), $cart_item_key ); return '' . $remove_link . ' ' . $product_name . ''; } return $product_name; } // Redirect empty Woocommerce cart and checkout page to the shop page add_action("template_redirect", 'wpsh_redirect_empty_cart'); function wpsh_redirect_empty_cart(){ global $woocommerce; if( is_cart() && WC()->cart->cart_contents_count == 0){ wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) ); } }
0685554432

Shop