New answers tagged

0

It's seems you have all variations same price. That's why it's not showing, it's a WooCommerce default behavior. You can change this WooCommerce default variable price filter with this hook. add_filter('woocommerce_show_variation_price', function() { return TRUE;});


1

I tried another solution and that did the trick. I found in the WooCommerce docs this little snippet: // Display 24 products per page. Goes in functions.php add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );. It is overriding the settings in the customizer. I only have to change the number '24' to my liking.


0

You can wrap your plugin in a check to see if WooCommerce is installed and active or not : if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { echo 'WooCommerce is active.'; } else { echo 'WooCommerce is not Active.'; }


-1

Get all woocommerce product and its details like sku,price,product name $sql = "SELECT * FROM `wp_posts` wp LEFT JOIN wp_postmeta wpm ON wp.ID=wpm.post_id WHERE post_type='product'"; $results = $wpdb->get_results($sql); print_r($results);


0

I don't know what hook Woocommerce uses to add that customizer code, but in your functions.php you'll have to hook your own function on a later time, like this (the last number is the lower priority): add_action ('the_name_of_that_hook','wpse_280836_mycontrol', 99) Now in the function you are hooking, you must first remove the existing control and the add ...


0

Fixed! I had to use the wp hook which means that the redirect function is only run once the whole page is loaded! Sweet :) add_action( 'wp', 'redirect' ); function redirect() { if ( is_page('my-account') && !is_user_logged_in() ) { wp_redirect( home_url('/login') ); die(); } }


0

You're passing two parameters to _n function, the first one is the pattern for one item, and the second for 2 or more. Just change the pattern. Show only numbers: <?php echo sprintf (_n( '%d', '%d',count( WC()->cart->get_cart())),count( WC()->cart->get_cart())); ?> Show item for two or more: <?php echo sprintf (_n( '%d', '%d items',...


0

Alright so this isn't too difficult, first we will just check if the menu item is a taxonomy then get the count and display it! function ggstyle_menu_item_count( $output, $item, $depth, $args ) { // Check if the item is a Category or Custom Taxonomy if( $item->type == 'taxonomy' ) { $object = get_term($item->object_id, $item->object)...


0

If you create your own shortcode based on the product category shortcode function duck_product_categories( $atts ) { global $woocommerce_loop; $atts = shortcode_atts( array( 'number' => null, 'orderby' => 'name', 'order' => 'ASC', 'columns' => '4', '...


0

I eventually figured this out, I don't know exactly why, but it seems the issue was due to the original use of init, once i replaced it with 'wp_head' it worked correctly, my final code looked like this function change_default_galleria_header() { remove_action( 'storefront_header', 'storefront_header_cart', 4 ); remove_action( 'storefront_header', '...


0

WooCommerce 2.6 brings major change in shipping module. Shipping zones are introduced in WooCommerce 2.6 to bring more flexibility while configuring your shipping methods. Legacy shipping methods (Flat Rate, International Flat Rate, Local Pickup and Delivery, and Free Shipping) are deprecated. So, it’s highly recommended to disable these and ...


0

Woohoo, I actually got it working. Had to use new DateTime() with the variables and $diff->days to display the days. Now just to prevent the function from duplicating the meta information in the rare cases where some store manager changes the status by accident back and forth between completed and some other status. Ideas? function ...


4

You're damned if you do, and you're damned if you don't. But it's typically better to "do". I have been working in WordPress support and development for a number of years now - and I can certainly say it's much better to keep everything up to date. Wait a little bit (2 weeks or so) after major updates before making the change to allow time for maintenance ...


0

I think that I figured this out. In my functions.php file I had the below function to redirect to the checkout page when a product is added to the cart. So I captured the username variable there and then added it to the redirected URL: add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); function redirect_to_checkout() { global $woocommerce; ...


0

After reinstalling Wordpress the issue still wasn't resolved. The site was running on php7.0 what ended up being the cause of my original issue. Switching back to php5.6 did the trick. Site is back up and running again. Thanks for the help!


0

Thank you TheDeadMedic, register_taxonomy solved my problem, although it was not as simple as just register_taxonomy( 'product_cat' ). There was a bit more to that, but I found the correct way to implement it in the Woocommerce function register_taxonomies(). So to summarize, if you want to use a wp_get_post_terms in a cron job and the used taxonomy is not ...


0

I don't know how Woocommerce handles featured images, but in WP you would do it like this: <img src="'.wp_get_attachment_url( get_post_thumbnail_id($item->ID)).'" alt="'.$item->post_title.'" title="'.$item->post_title.'" />


0

If you're using SSL (HTTPS URL) you don't need to use oauth1.0 with oauth signature and everything. All you need to do is pass in the consumer_key and consumer_secret in the url https://localhost/wpShop/wc-api/v2/products?consumer_key=ck_1111111111122123&consumer_secret=cs_232332322233232 That's it! However, if your URL is NOT SSL, then you have to go ...


0

If I were you I would print_r($category) and make sure it is giving you ID's and not slugs. Also, you are submitting $category to both product_cat and brands. If your field type were slug instead of id, and terms were exactly the same in both product_cat and brands then this would work... though it doesn't make sense in the grand scheme of things. Your ID'...



Top 50 recent answers are included