Forum Replies Created

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter dineintec

    (@dineintec)

    Thank you for your help – this half works as I expected to now. I removed:

    // change the add to cart button
    add_filter( 'woocommerce_loop_add_to_cart_link', 'woosq_loop_add_to_cart_link', 99, 2 );
    function woosq_loop_add_to_cart_link( $link, $product ) {
    	return '<span class="button">' . esc_html( $product->add_to_cart_text() ) . '</span>';
    }

    As I want the add to cart button to function as normal. It is just the “Select Option” button I wanted to change which still works when removing this code which is great.

    But now my quantity increment buttons (and text field in between) activate the quick view which I do not wish and would like them to remain the same action as before.

    Also, when clicking on “add to cart” the quick view flashes on and off quickly – I would like this to operate as normal please.

    Thread Starter dineintec

    (@dineintec)

    I’ve removed the quick view button:

    // remove single product page link
    remove_action( 'woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_shop_loop_item','woocommerce_template_loop_product_link_close', 5 );
    
    // remove quick view button
    add_filter( 'woosq_button_position', function() {
        return '0';
    } );
    
    // hide single product page completely
    add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
    function hide_product_page($args){
      $args["publicly_queryable"]=false;
      $args["public"]=false;
      return $args;
    }

    Now just need to change the link for the product image and “select options” button (for variable products) if any one can assist?

    I’m guessing it would be something along the lines:

    add_action( 'woocommerce_before_shop_loop_item','**SOMETHING TO GO HERE**', 10 );
    add_action( 'woocommerce_after_shop_loop_item','**AND SOMETHING TO GO HERE**', 5 );
    Thread Starter dineintec

    (@dineintec)

    I’ve removed the quick view button:

    // remove single product page link
    remove_action( 'woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_shop_loop_item','woocommerce_template_loop_product_link_close', 5 );
    
    // remove quick view button
    add_filter( 'woosq_button_position', function() {
        return '0';
    } );
    
    // hide single product page completely
    add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
    function hide_product_page($args){
      $args["publicly_queryable"]=false;
      $args["public"]=false;
      return $args;
    }

    Now just need to change the link for the product image and “select options” button (for variable products) if any one can assist?

    I’m guessing it would be something along the lines:

    add_action( 'woocommerce_before_shop_loop_item','**SOMETHING TO GO HERE**', 10 );
    add_action( 'woocommerce_after_shop_loop_item','**AND SOMETHING TO GO HERE**', 5 );
    • This reply was modified 4 years, 6 months ago by dineintec.
    Thread Starter dineintec

    (@dineintec)

    I realise this could be achievable with a snippit. I have following snippet to remove the current product image link and to disable single product pages:

    // remove single product page link
    remove_action( 'woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_shop_loop_item','woocommerce_template_loop_product_link_close', 5 );
    
    // hide single product page completely
    add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
    function hide_product_page($args){
      $args["publicly_queryable"]=false;
      $args["public"]=false;
      return $args;
    }

    But would not know what code to extract from your plugin’s function.php and how I would implement it into the above snippet. What would I need to extract from here:

    add_action( 'init', array( $this, 'woosq_init' ) );
    
    // menu
    add_action( 'admin_menu', array( $this, 'woosq_admin_menu' ) );
    
    // enqueue scripts
    add_action( 'wp_enqueue_scripts', array( $this, 'woosq_wp_enqueue_scripts' ) );
    
    // ajax
    add_action( 'wp_ajax_woosq_quickview', array( $this, 'woosq_quickview' ) );
    add_action( 'wp_ajax_nopriv_woosq_quickview', array( $this, 'woosq_quickview' ) );
    
    // link
    add_filter( 'plugin_action_links', array( $this, 'woosq_action_links' ), 10, 2 );
    add_filter( 'plugin_row_meta', array( $this, 'woosq_row_meta' ), 10, 2 );

    …and how would I use this in my snippet?

Viewing 4 replies - 16 through 19 (of 19 total)