• Hello, wondering if anybody could help me. I have following code in snippets activated:

    // 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;
    }

    This disables the product image links and also single product pages. I would however like to change the image link so it calls up the same function as the “Quick View” button below does. I would also like the same for the “Select Options” button too if possible.

    I tried implementing the link section functions from the plugins function.php file but of course broke my site in doing so.

    If any one can help that would be most grateful.

    Here is the code from the plugin, just needing to know what I need to extract and then implement into snippets:

    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 );

    Plugin in question is WC Fields Factory.

    • This topic was modified 4 years, 6 months ago by dineintec.
    • This topic was modified 4 years, 6 months ago by dineintec.

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

Viewing 1 replies (of 1 total)
  • 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 );
Viewing 1 replies (of 1 total)
  • The topic ‘Use code snippets to change product links to quick view’ is closed to new replies.