Woocommerce pagination and result count after custom loop

You’re complicating things quite a bit with some of your query syntax, and WooCommerce actually discourages using WP_Query() to retrieve products. They even claim it can end up breaking down the road. I recently wrote an article on how to do what you want, complete with an example here: https://cfxdesign.com/create-a-custom-woocommerce-product-loop-the-right-way/

Display single category name in woocommerce loop

<?php remove_action(‘woocommerce_shop_loop_item_title’, ‘woocommerce_template_loop_product_title’, 10); function loop_title() { global $post;?> <div class=”col-xl-3 col-md-3 col-sm-3″> <h3><a href=”https://wordpress.stackexchange.com/questions/304779/<?php the_permalink(); ?>” class=”feed-item-baslik”><?php the_title(); ?></a></h3> <?php $terms = get_the_terms( $post->ID, ‘product_cat’ ); if ( $terms && ! is_wp_error( $terms ) ) : if ( ! empty( $terms ) ) { echo $terms[0]->name; }?> <?php endif;?> </div> <?php } add_action(‘woocommerce_shop_loop_item_title’, ‘loop_title’, … Read more

Override static method in WC_Shortcodes class (shortcode) [closed]

This is how you can (or should) remove the default Shortcode: // Hook after `WC_Shortcodes::init()` is executed. add_action( ‘init’, function(){ // Remove the shortcode. remove_shortcode( ‘product_categories’ ); // Add it back, but using our callback. add_shortcode( ‘product_categories’, ‘my_product_categories_shortcode’ ); }, 11 ); And here’s how you can modify the default Shortcode’s output: function my_product_categories_shortcode( $atts … Read more

Can’t remove woocommerce sidebar

First, most themes have multiple page templates you can choose from. Please check: go to cart page (in wp-admin). See side metabox ‘Page Attributes’. There you can set the page template, does it have something like ‘full_width’? You can also try a different hook, like wp_head. Example: add_action( ‘wp_head’, ‘urun_sidebar_kaldir’ ); Let me know. After … Read more

Pre filter woocommerce products to remove a certain category of products

You can use the pre_get_posts hook for Woocommerce product query, but here the example is for the main query. function wpse_306252_query( $query ) { if($query->is_main_query()) { $query->set( ‘category__not_in’, YOUR_CAT_ID); } } add_action( ‘pre_get_posts’, ‘wpse_306252_query’ ); If you want the opposite of it, I think the best is to add a SquareExport parameter to check when … Read more

Add post with approval by the admin

Set New User Default Role to Contributor. Change user role of existing users as well, if needed. UPDATE Add this to your functions.php file. It’ll allow your contributor and author users to add WooCommerce products. And then set default user role to contributor as I suggested before. function wpse_306836_wc_custom_permission( $args, $post_type ) { if ( … Read more

Exact Hook to payment methods

Like I said before change manually the data through admin works well with the woocommerce_order_status_processing hook. But the gateway I’m using was using other method and consequently other hook. The right hook is woocommerce_update_order. Inside this hook was needed to use a conditional check if the status change to processing. public function create_memberplan_after_update_order($order){ $order = … Read more

In WooCommerce can you make a list of ‘steps’ for quantity increase? [closed]

unfortunately, the quantity input doesn’t support this. The quantity input is rendered in the following template: global/quantity-input.php. You can see in the template that it’s using an html input element, of type ‘number’, which doesn’t support custom steps. Using a filter in this case just can’t work. If you are sure that you will always … Read more