New answers tagged

0

To avoid that error, you have to add something in your function like: add_filter( 'woocommerce_email_recipient_new_order', 'tm_destinatario_condicionado_wc', 10, 2 ); function tm_destinatario_condicionado_wc( $recipient, $order ) { // To avoid an error in backend if( ! is_a($order, 'WC_Order') ) return $recipient; $estados = array( '...


0

I want to understand if I can write my own templates using only the conditional tags, or if i need to maintain the actual structure of the templates that include a lot of do_action() and less markup, I've not modified them, just copied inside the mytheme/woocommerce/ folder of my theme for now. WooCommerce extensions all make extensive use of those ...


1

Try editing in the 'text' editor and adding   on the empty lines and see if that gets stripped out. Update: Here's a screen capture, yeah it gets stripped out because of WordPress' default formatting (wpautop), but it still registers what was intended. Here's the text: Now here's the end result on the front end: There must be something stripping ...


1

To answer your second question you'll have to properly enqueue the Bootstrap 4 styles and scripts: Including CSS & JavaScript | Theme Development From there you either have to add existing WooCommerce classes to your BootStrap CSS or add BootStrap classes to your WooCommerce templates (preferred/recommended). As for the templates, it really depends on ...


2

Yes, you can use it like: if ( is_product_category('cheese', 'fruit', 'meat') )


0

function _category_dropdown_filter( $cat_args ) { $cat_args['show_option_none'] = __('My Category'); return $cat_args; } add_filter( 'widget_categories_dropdown_args', '_category_dropdown_filter' );


1

In my experience with woocommerce, there are two ways. 1 - Add some extra css to your current theme. For example I want to modify the title of the product : I open the chrome inspector, I see that the product page has a class css for body.single-product. The product container has a class css div.product (create by woocommerce itself <div id = "...


0

Use this query to display woocommerce featured product and replace with yours $meta_query = WC()->query->get_meta_query(); $meta_query[] = array( 'key' => '_featured', 'value' => 'yes' ); $featured = array( 'post_type' => 'product', 'stock' => 1, 'showposts' => 6, 'orderby' => 'date', ...


1

Follow This and Make sure Your Shop or which page you want for default Home page and Then Save Button. Thanks


0

This is how I achieved the solution: global $product; if ( $product->is_type('variable') ) { $taxonomy = 'pa_sizes'; // The product attribute taxonomy $sizes_array = []; // Initializing // Loop through available variation Ids for the variable product foreach( $product->get_children() as $child_id ) { ...


0

You can change your "reading Settings" in Settings menu, Please select "Your home page displays" = check to a static page and select shop from the dropdown menu. after these changes your index page will be shop page.


0

Wordpress stores three levels of stock information on the wp_postmeta. Each product has manage stock enabled Stock Quantity Stock Status Since the products on the above questions were imported, few of them didn't had manage stock enabled so updating the stock quantity to 0 didn't work well. Solution: I forcefully updated the manage stock to be yes and ...


0

I got an answer from stackoverflow, this works but the all the sizes are being shown in a single button, I want to show all sizes in separate buttons, like the above screenshot has. I know its possible by adding a loop before echoing my button, my loop is not working global $product; if ( $product->is_type('variable') ) { $taxonomy = '...


0

The solution to my problem was to use: has_term( 'the-cat-I-want-to-display', 'product_cat' ) || is_product_category( 'the-cat-I-want-to-display' ) This worked. Thanks everyone for your help!


0

The WooCommerce conditional function is_product() is a wrapper of the WordPress conditional function is_singular() which allow only post types as arguments but not post Ids… So that's why it doesn't work as you expect. So maybe you need to use something else instead like: <?php if ( is_shop() || ! in_array( get_the_id(), array( 15852,15859,15863,15866 ) ...


0

Without seeing your actual site, the best I can come up with is what I believe is the standard WooCommerce HTML and use that target the specific element. In CSS: section.related.products ul.products li.product span.price{ display:none; } I guess as an alternative you could write a quick jQuery to remove that element altogether or you could replace ...


0

return defined('WC_VERSION'); should fix since defined() accepts a string as parameter. https://www.php.net/manual/en/function.defined.php If you use: require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); adjusting your path if the installation is in a subrdir you load all the WP environment including active plugins etc


0

$order_statuses = array('wc-completed'); $customer_user_id = get_current_user_id(); // current user ID // Getting current customer orders $customer_orders = wc_get_orders( array( 'meta_key' => '_customer_user', 'meta_value' => $customer_user_id, 'post_status' => $order_statuses, 'numberposts' => -1 ) ); foreach($...


0

I guess you should use your function on the hook woocommerce_add_to_cart instead of template_redirect


0

somehow WPForm accepted the meta keys from WooCommerce. I used this one. billing_first_name billing_last_name billing_company billing_address_1 billing_address_2 billing_city billing_state billing_postcode billing_country billing_email billing_phone customer_user But Country meta key didn’t worked for me. Someone an idea how to store the information with ...


0

At first I will notice that logging in with the username only sounds like a insecure solution . You should not display the form in the init action hook. Add form display function to the action hook from checkout page (e.g. woocommerce_before_checkout_form) or overwrite the checkout template in the active theme and insert the form there. if ( ! ...


0

As stated in question, the solution to that problem is to set the woocommerce posts per page ( Apperance > Customize ) and your custom 'posts_per_page' to the same number. Hope it helps.


0

You can try this action. Put this line into your active theme functions.php file remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );


0

try out this plugin hop it's work for you https://wordpress.org/plugins/woo-bulk-price-update/


-1

It happens in some minor cases. If you have a fresh WordPress installation, then install and Activate the WP Reset plugin from Plugins > Add New. Head over to Tools > WP Reset and then at the end of the page, type on Reset in the given box and click on Reset. This will reset your WordPress installation's database and some other things. Similarly, go to ...


2

Welcome to StackExchange. As mentioned on comments by @aravona and @Rup it will be harder to give you a good answer without more context. In any case, I think you have a couple basic approaches to achieve what you want: using WordPress template_redirect hook or .htaccess rules. The most performant would be htaccess, but it would be more prone to redirect ...


0

i have seen some ware a query to fetch products image from database. may be it will help you. just set required parameters as per your requirement. SELECT p.ID,am.meta_value FROM wp_posts p LEFT JOIN wp_postmeta pm ON pm.post_id = p.ID AND pm.meta_key = '_thumbnail_id' LEFT JOIN wp_postmeta am ON am.post_id = pm.meta_value AND am.meta_key = '...


0

as i used @dannie Herdyawans code snippet, it shows that get_files() function is deprecated. so instead of that use get_downloads() function. listed below example. $downloads = $productObj->get_downloads(); if ($downloads): foreach ($downloads as $key => $each_download) { $product->productDownloadUrl = $each_download['file']; $...


1

Yo don't properly call the callback function. If you want to code on oriented object programmation, you have to create your class, and construct function with add_action... Here more informations about it : https://wordpress.stackexchange.com/a/48094/9716 or you do something like this (its no POO but its working as well). add_action( '...


0

I understand correctly that you want to filter them in woocommerce (products) by color - by clicking on the colored square? If so, here is the plugin you need. YITH WooCommerce Ajax Product Filter DEMO


0

For is_front_page() and is_home() condition: Important: Please note that these functions work only once WordPress is loaded such as on template files or specific action hooks. You can’t just dump these conditionals into functions.php and expect them to work.


0

First, I'm getting confused in the setup here. From the initial posPrintReceipt function, am I attempting to print what's inside the newHTML variable? or something else altogether? Yes, but the WooCommerce code appears to append the newHTML content to the existing page (as observed by the use of window.print();), likely taking advantage of a @media print ...


0

To add a specific class you must check each item in the cart, and check with the slug of the class which items correspond, in this way: First add the woocommerce_package_rates filter add_filter( 'woocommerce_package_rates', 'different_rates_based_on_quantity_steps', 10, 2 ); Then insert the function function different_rates_based_on_quantity_steps ( $...


0

Here is the solution <?php echo '<h2>Previous Donations for this Nonprofit</h2>'; foreach (get_posts('post_type=shop_order&numberposts=-1&post_status=wc-completed') as $order) { if (is_user_logged_in()) { $order = new WC_Order($order->ID); echo $order; foreach($order->get_items('line_item') ...


0

If I'm not mistaken ... Then all these settings with taxes and countries are in woocommerce in a box. You only need to configure it correctly.


0

There's a few ways to do this, here are two: Method #1 In your theme (parent or child if you are using a child theme to extend the parent) create a folder structure as follows: {your_theme_folder} ∟ woocommerce (directory) ∟ single-product (directory) ∟ price.php (copy from wp-content/plugins/woocommerce/templates/single-product/price.php)...


0

I find and use below code for when user in cart page and cart not empty: add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout'); function dj_redirect_checkout($url) { global $woocommerce; if(is_cart() && !is_user_logged_in() ){ $checkout_url = 'digits login url'; } else{ $checkout_url='https://...


0

There are many payment plugins that help in making payment secure and safe. These plugins are really helpful for any e-commerce site. There are 2 types of gateways which include direct or hosted payments.


0

Elsner Moneris Direct Payment Gateway for WooCommerce provides you a direct payment path without redirecting it to any other page. Except they also provide great after-sale technical support.


0

still,users who also search for a solution to ease WooCommerce site management, including import of valiables, can consider Store Manager and its trial version for testing


0

There are many plugins available on the internet for payment gateways. Extensions not only for payment but also for other things as well are also listed on the internet which will be helpful for e-commerce sites.


0

Welcome to WPSE. You can use a WordPress WooCommerce hook to achive this. Just like WordPress itself, WooCommerce also allows you to use hooks and filters to customize your shop. You need to add the following code to the functions.php of your current theme. This code adds a simple link after the WooCommerce add to cart button. // This function gets the ...


0

Media Cleaner WordPress Plugin is pretty good enough - https://wordpress.org/plugins/media-cleaner/ I like it as it has support for other plugins like Advanced Custom Fields (ACF), Divi Builder, Visual Composer and Elementor.


0

You can try with below condition for shop page only. if ( $product->is_type( 'variable' ) && is_shop()) {


0

This issues happens on new woocommerce version. The older versions of woocommerce reloaded the cart after the update. But in newer versions there is a ajax action bound to that. This action blocks the default form action and fire the ajax.


0

Maybe try using the wp_new_user_notification() function instead. That function is what gets triggered when a new user signs up. My feeling is that all the data you need is going to be available to send in a new message. There's a solid example in the link I posted. I hope this helps!


0

I'm not sure how WooCommerce adds these fields, but I suspect it uses add_user_meta after the user_register form or something. Try and catch it this way instead: if ( isset( $_POST['first_name'] ) ) { $first_name = $_POST['first_name']; }


1

The message is suggesting you can hide this area by going into the admin backend customizer. You can find these setting in the customizer by going to Admin > Appearance > Customize. Once you have the customizer open the exact setting will depend on your theme. It may be nested under the WooCommerce tab or another tab created by your theme. Just poke ...


Top 50 recent answers are included