• Resolved ctor

    (@ctor)


    Hello,

    After the plugin is enabled, the add to cart button from the product category page is missing. It is showing in the product page.

    Thanks,
    Victor

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ashok G

    (@wpashokg)

    @ctor I ran into a similar issue where my variable products had no button i was able to fix by adding the following code into my content-product.php override template. I added around line 51. You may need to tinker with the php some to get it how you want but this is the gist of it.

    Edit – it isn’t a ‘Add to cart’ button, only a link to product but better than no button ??

    <?php
    	global $product;
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    	// $product->is_type( $type ) checks the product type, string/array $type ( 'simple', 'grouped', 'variable', 'external' ), returns boolean
    
    	if ( $product->is_type( 'variable' ) && is_plugin_active( 'woo-min-max-quantity-limit/woo-min-max-quantity.php' ) ) {
    
    		    // Output the custom button linked to the product
    	    echo '<div style="margin-bottom:10px;">
    	        <a class="button custom-button" href="' . esc_attr( $product->get_permalink() ) . '">' . __('View product') . '</a>
    	    </div>';
    } ?>
    • This reply was modified 6 years, 5 months ago by ionz149.
    Plugin Author Ashok G

    (@wpashokg)

    Good work kudos @ionz149

    Just a suggestion: In my opinion, the ideal UX would be the following:

    If a product does not have min or max requirements set – continue to show “Add to Cart”.

    If it does have a min and/or max, have the Add to Cart button/link change to a product link with Select Options (or whatever text) – similar to how those buttons change when it’s a simple product vs. a variable product.

    -Jeff

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add to cart button missing’ is closed to new replies.