Forum Replies Created

Viewing 15 replies - 31 through 45 (of 122 total)
  • Prasad Nevase

    (@prasad-nevase)

    Did you place the second code block in your there’s functions.php file? Also do note that it will only work for new orders. It won’t update status for old orders which have cod payment method.

    Prasad Nevase

    (@prasad-nevase)

    The order status should have been checked like below:

    $order->post_status === 'wc-processing'

    Below is the complete corrected code:

    
    add_action( 'woocommerce_thankyou', 'my_order_status', 10, 1 );
    function my_order_status( $order_id ) {
    	if ( ! $order_id ) {
    		return;
    	}
    	$order = wc_get_order( $order_id );
    	if ( ( get_post_meta( $order->id, '_payment_method', true ) === "cod"  ) && ( $order->post_status === 'wc-processing' ) ) {
    		$order->update_status('on-hold');
    	}
    }

    I hope this helps ??

    Prasad Nevase

    (@prasad-nevase)

    So you will create “Street” as category using WooCommerce Default product category. Then you will create “Type” as custom taxonomy and “T-shirt” as category under that custom taxonomy. (Note that you may run into problems if you register “Product Type” as custom taxonomy because that’s WooCommerce’s default hidden taxonomy).

    To guide you, I registered custom taxonomy “Type” on my local using below code. I placed this code in my theme’s functions.php file (you may not need this if you have already registered custom taxonomy):

    add_action( 'init', 'pn_create_product_type_tax' );
    
    function pn_create_product_type_tax() {
    	register_taxonomy(
    		'type',
    		'product',
    		array(
    			'label' => __( 'Product Type' ),
    			'rewrite' => array( 'slug' => 'type' ),
    			'hierarchical' => true,
    		)
    	);
    }
    

    Then I assigned “Street” category to some of the products and “T Shirt” category from the “Type” custom taxonomy. Then I created the shortcode using following code which I placed in my theme’s functions.php file:

    add_shortcode('best_sellers', 'pn_show_best_sellers');
    
    function pn_show_best_sellers( $atts ) {
        $atts = shortcode_atts( array(
          'columns' => '4',
          'orderby' => 'title',
          'order'   => 'asc',
        ), $atts );
    
        $query_args = array(
          'post_type'           => 'product',
          'post_status'         => 'publish',
          'ignore_sticky_posts' => 1,
          'orderby'             => $atts['orderby'],
          'order'               => $atts['order'],
          'posts_per_page'      => 12,
          'product_cat'         => 'street', /* you may need to change this as per your category slug */
          'type'                => 't-shirt' /* you may need to change this as per your category slug */
        );
    
        $products = new WP_Query($query_args);
    
    		$columns = $atts['columns'] ;
    		$woocommerce_loop['columns'] = $columns;
    
    		ob_start();
    
    		if ( $products->have_posts() ) {
    			?>
    
    			<?php woocommerce_product_loop_start(); ?>
    
    				<?php while ( $products->have_posts() ) : $products->the_post(); ?>
    
    					<?php wc_get_template_part( 'content', 'product' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			<?php woocommerce_product_loop_end(); ?>
    
    			<?php
    		} else {
          echo __( 'No products found' );
        }
    
    		woocommerce_reset_loop();
    		wp_reset_postdata();
    
    		return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
    }

    I created simple page named “Best Seller Shirts” and placed the shortcode like below:

    [best_sellers]

    On front end it listed only those products which had both “Street” and “T Shirt” category assigned.

    I hope this helps.

    • This reply was modified 8 years ago by Prasad Nevase. Reason: code formatting and comments
    Prasad Nevase

    (@prasad-nevase)

    So for those 3 main categories every one of them should have a shop page which I’ll set up new arrivals etc.

    I believe those would be category archive pages. So for if you assign both Motorcross & T-shirt (custom taxonomy) to a product then when user clicks on Motorcross category, the resultant category archive page is going to show all products which have Motorcross and T-shirt assigned to it.

    But, I will suggest revisit your requirement and think if you really need to make Gender, Product Type & Brand as custom taxonomy and not product attributes?

    Prasad Nevase

    (@prasad-nevase)

    Hey Gary, its not a pain at all. Thats doable. However, you need to decide how long the title could go. Based on that you can decide the min-height for each container. For example:

    1. Parent container min-height: 360px
    2. Image container min-height: 255px
    3. Title container ming-height: 90px (assuming title can be max 3 liner)

    So below would be the updated/additional css:

    .wf-cell {
        min-height: 360px; /* earlier it was 350px */
    }
    
    .project-list-media {
        min-height: 255px;
        display: flex;
        flex-direction: column;
        align-content: flex-end;
        justify-content: flex-end;
    }
    
    .project-list-content {
        min-height: 90px; /* Sufficient for 3 liner text. */
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-content: flex-end;
    }

    Also, all this turning out to be theme related support and not related to WooCommerce. Hence, I would suggest for any further theme specific customisation you may prefer posting it as a job on some marketplace like this.

    I hope this helps.

    Prasad Nevase

    (@prasad-nevase)

    Kindly create a new topic for distinct queries where you need support.

    With regards to your latest query however, I would suggest getting in touch with WPML Support for faster and first hand details.

    Prasad Nevase

    (@prasad-nevase)

    Then there is something in child theme itself. Check the custom js files or functions.php file. There must be something in it.

    Prasad Nevase

    (@prasad-nevase)

    As I could not reproduce this even after installing some of the plugins (except paid plugins like WPML etc.) which you are using, Its difficult to say exactly what could be causing this. I think you may try disabling password strength checker (if not needed) using below code. Place this in your functions.php file:

    function wc_disable_password_strength_meter() {
    	if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
    		wp_dequeue_script( 'wc-password-strength-meter' );
    	}
    }
    add_action( 'wp_print_scripts', 'wc_disable_password_strength_meter', 100 );

    OR

    If something is not working after an update, a likely cause is an outdated or non compatible plugin or theme. The best thing to do is to narrow down the cause. To do this you can temporarily:

    • Switch to a default WordPress theme (Twenty Twelve) and test again
    • Disable all other plugins except for WooCommerce itself, retest, and re-activate plugins until the issue occurs. This will help you find the culprit.
    • This reply was modified 8 years ago by Prasad Nevase. Reason: edited the function name

    I tried to replicate this by installing some of the plugins which you are using. But I could not replicate it. I would suggest taking basic steps like, using default theme with only WooCommerce as active plugin. Then activate other plugins one by one and keep testing. That will help figure out what is creating conflict – like whether its a theme or any other plugin.

    Great. I use Chrome browser and its web developer toolbar. Check this for more help on the same.

    Please change the css code I provided. Change .product to body.archive .product. That shall fix it.

    Glad that I could help. Keep going ??

    My bad! The css class should have been .wf-cell and not .cell. Sorry for that. Please refer below corrected css code. This shall give you intended result.

    .wf-cell {
        min-height: 350px;
    }
    
    .product {
        position: absolute;
        bottom: 20px;
        left: 15px;
        right: 15px;
    }

    Could you leave the CSS there on the site and let me know? I will be around for another 15-20 minutes and can do a quick check.

    Please see this screencast. The code I suggested is working fine. May be it will be more clear after viewing the screencast.

Viewing 15 replies - 31 through 45 (of 122 total)