Home Forums WoodMart support forum Open products in new tab

Open products in new tab

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #88376

    John
    Participant

    Hello again,
    Hope you can help me with this. I would like to add a custom function code with class for visual composer.

    add_filter( 'woocommerce_loop_add_to_cart_link', 'businessbloomer_add_target_blank', 10, 2 );
     
    function businessbloomer_add_target_blank( $product, $args ){
     
    $link = sprintf( '<a href="%s" target="_blank" data-quantity="%s" class="%s" %s>%s</a>',
            esc_url( $product->add_to_cart_url() ),
            esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
            esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
            isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
            esc_html( $product->add_to_cart_text() )
    );
     
    return $link;
     
    }

    So let me explain what i need: I’m currently have a custom product builder and i will put your popup with some products on them, but when i will click on products i will like them to open in a new tab.
    I’m thinking adding a custom classes on visual composer so only those products will run like that(openeing in a new tab)
    Waiting for your answer. Hope it is possible 😀

    #88390

    Artem Temos
    Keymaster

    Hi,

    Sorry, but this question requires help with additional customization and theme support scope doesn’t include this.

    Kind Regards

    #88392

    John
    Participant

    Ok … thanks really appreciate for your support.

    #88394

    Artem Temos
    Keymaster

    Thank you for your understanding.

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

The topic ‘Open products in new tab’ is closed to new replies.