Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #219516


    I created 2 websites ( and based on WP 3.8. (German), Flashlight 2.4.1 and WooCommerce 2.0.20.

    The only differences are their products, product categories and the main-menu.
    On I offer variable products, on simple products.

    To my surprise I notice a different behavior of the shop [GALERIE] on the catalog page, when I hover the mouse over the top button of a product image.

    On the top button shows the “icons-shop-options.png” and says “Optionen ansehen” [show options]. Clicking on this button opens the product detail page.

    On the top button shows the “icons-shop-cart.png” and says “In den Warenkorb” [Add to cart]. Clicking on this button opens the cart page.
    If, however, there is no price assigned to a product, the top button shows no icon and says “Weiterlesen” [Read on / Continue]. Clicking on this button opens the product detail page.

    * * * *
    So, on you are unable to get to the product details page, if the product has a price tag.

    See > GALERIE > Keramik > Schale (Schale 6291 is the product without a price tag – all other products do not allow you to see the product detail page)

    * * * *
    How can I make the button on behave like the button on (i.e. allowing to open a product detail page from the catalog page) ?

    * * * *

    For test purposes I replaced my files flashlight/woocommerce-config/config.php and woocommerce-mod.css with the original (downloaded) files – no change.

    WP 3.8.1 did not change the behavior either.

    * * * *
    On the only way to see the product detail page is: add the product to the cart, go to the cart, click on the product link.

    I would very much appreciate your help.




    Hi bruwa!

    Add this on functions.php to redirect the “Add to Cart” button the single product page.

    add_filter( 'add_to_cart_url', 'avf_change_add_to_cart_url' );
    function avf_change_add_to_cart_url( $link ) {
        global $product;
        $link = get_permalink( $product_id );
        return $link;

    Best regards,



    Thanks for the quick reply!

    I added the code to flashlight/functions.php – unfortunately no change.

    Any other suggestion?



    it seems that the problem has to do with the simple-type of the products (as opposed to variable-type):

    – On I offer simple-type products (see GALERIE)
    – Hovering the mouse over a product image on a product category page brings up 2 buttons:
    1) “In den Warenkorb” [Add to cart]
    2) “Bild vergrössern” [Expand image]

    I need to change the function and the text of this “Add to cart” button:
    -> I want the top button to open the product details page (NOT to add to cart) and make it display “Einzelheiten”
    -> However: the “add to cart” button on the product details page must be left unchanged!

    Whether or not the product’s inventory-option “single-product” is activated or not, does not make any difference.

    Currently the user is unable to access the product detail page (you want to check the product details before adding to cart).

    Thanks for helping


    May I point out a possible source for confusion:
    – “Simple-type of product” = there are no variations of the product
    – “Single-product” = only 1 copy can be ordered


    maybe this can give you another clue:

    Depending on whether the product has a price or not, the behavior of the top button is different:
    without price: no icon; text “Read more”; action: opens the single product page; button is named “button product_type_simple

    with price: cart icon; text “Add to cart”; action: adds the product to the cart; the button is named “add_to_cart


    Meanwhile I noticed another (in my view) strange behavior of the button (on catalog/category page)

    When I click on the button “Add to cart” (no icon shown) , the icon “shop-added” appears next to the text “Add to cart” and the product is added to the cart (the screen still shows the catalog/category page)

    If I push the same button a second time, the product is added to the cart, but this time the single product page opens, while on top of the page an error message appears “The product is already in the cart” together with a button “Show cart” (overlaying and hence partly hiding the error message).

    Whether or not I added the code you suggested to flashlight/functions.php, the behavior of the button is always as mentioned.


    May I reframe my question:
    – Which codes define the button’s behavior?
    – In which files ca I find these codes?
    How can I make the button to behave identically, regardless whether the product has a price or not? I want it always to open the single product page.




    in the file wp-content/plugins/woocommerce/templates/loop/add-to-cart.php
    – On line 30 I found the code “switch ( $handler ) {”
    – I added/inserted the following (line 31):

    case “simple” :
    $link[‘url’] = apply_filters( ‘variable_add_to_cart_url’, get_permalink( $product->id ) );
    $link[‘label’] = apply_filters( ‘variable_add_to_cart_text’, __( ‘CUSTOM LABEL’, ‘woocommerce’ ) );

    Bingo – This did the trick




    Glad you figured it out. :)


Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Unexplained button behaviors – unable to get to the product detail page’ is closed to new replies.