Fatal Error in WordPress WooCommerce theme “Call to undefined function wc_get_theme_slug_for_templates()”

Ok, the error is telling you this: The error comes from this theme file: \themes\vw-ecommerce-shop\woocommerce\global\wrapper-end.php Line: 23. In that file on line 23 the following function is called wc_get_theme_slug_for_templates() but at that point it’s not (yet) available. The function should be available though, because it’s a valid Woocommerce function, see here. Can you update your … Read more

how to add custom functionality after woocommerce place order button

You can use woocommerce_after_checkout_validation for custom validation. Following snippet might be helpful for you. //Action to validate add_action(‘woocommerce_after_checkout_validation’, ‘after_checkout_otp_validation’); //The function function after_checkout_otp_validation( $posted ) { // you can use wc_add_notice with a second parameter as “error” to stop the order from being placed if (error) { wc_add_notice( __( “Incorrect OTP!”, ‘text-domain’ ), ‘error’ ); … Read more

Hiding products with a specific tag from WooCommerce main shop page

You can paste the following snippet in your child theme’s functions.php function exclude_specific_tag( $q ) { if (is_shop()){ $tax_query = (array) $q->get( ‘tax_query’ ); $tax_query[] = array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => array( ‘pré-commande’ ), // write the tag name to remove in between the ” ‘operator’ => ‘NOT IN’ ); $q->set( … Read more

Send a value to woocommerce with a button type submit

At the select tag you have 2 name attribute <select type=”number” step=”any” name=”actions” id=”actions-select” name=”wpneo_donate_amount_field” class=”input-text amount wpneo_donate_amount_field text”> Then, when you submit, it only collect the first defined name. (name=”actions”). You have to delete this attribute. and using name=”wpneo_donate_amount_field” only. It should like <select type=”number” step=”any” id=”actions-select” name=”wpneo_donate_amount_field” class=”input-text amount wpneo_donate_amount_field text”>

function to add note on single Woo Commerce product page for downloadable variations

For variable product, it’s not the product that you need to test but the variations : add_action( ‘woocommerce_before_add_to_cart_button’ , function () { global $product; $downloadable = FALSE; if (“simple” === $product->get_type()) { $downloadable = $product->is_downloadable(); } elseif (“variable” === $product->get_type()) { $variations = $product->get_available_variations(); foreach ($variations as $variation) { if ($variation[“is_downloadable”]) { $downloadable = TRUE; … Read more

products nested by subcategories in a current category archive

<?php $parentid = get_queried_object_id(); $args = array( ‘parent’ => $parentid ); $categories = get_terms( ‘product_cat’, $args ); if ( $categories ) : foreach ( $categories as $category ) : echo esc_html($category->name); $products = new WP_Query( array( ‘post_type’ => ‘product’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $category->slug, ), ) ) … Read more

How can I add an additional action button into the woocommerce admin order page?

Add this below code your current active theme functions.php file add_filter( ‘woocommerce_admin_order_actions’, ‘add_custom_order_status_actions_button’, 100, 2 ); function add_custom_order_status_actions_button( $actions, $order ) { if ( $order->has_status( array( ‘processing’ ) ) ) { // The key slug defined for your action button $action_slug = ‘invoice’; $status = $_GET[‘status’]; $order_id = method_exists($the_order, ‘get_id’) ? $the_order->get_id() : $the_order->id; // … Read more