• Resolved marianosmeiden

    (@marianosmeiden)


    English: I would like to know if there is any way to show the product button only in specific categories of woocommerce (I am referring to the button of the individual product page, not the floating button that is shown globally on the web) Thank you very much for your time.

    Spanish: Me gustaría saber si hay alguna forma de mostrar el botón de producto solo en categorías puntuales de woocommerce (Me refiero al botón de la pagina del producto individual, no al botón flotante que se muestra de forma global en la web) Desde ya muchas gracias por su tiempo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Monillo

    (@monillo)

    Hola @marianosmeiden
    Por supuesto que es posible ??
    Lee el apartado “A nivel de categoría o etiqueta”
    https://join.chat/es/docs/configurando-joinchat/

    Plugin Author Creame

    (@creapuntome)

    Hi @marianosmeiden, by default it’s not possible but you can do it with a PHP code snippet.

    Try with this:

    function joinchat_woobtn_custom_setting( $settings, $obj ) {
    
      // Exit if not is product.
      if ( ! is_singular( 'product' ) ) return $settings;
    
      /**
       * Can be one category slug or category ID or an array of slugs or IDs
       * e.g.
       * $categories = array('custom made', 'special');
       * $categories = array(75);
       */
      $categories = array( 'custom-made', 'special-gift' );
    
      // If product has category change Woo Buttton setting
      if ( has_term( $categories, 'product_cat', $obj ) ) {
    
        /**
         * Joinchat product button available positions:
         *
         * 'none'                                       => Don't show
         * 'woocommerce_before_add_to_cart_form'        => Before "Add To Cart" form
         * 'woocommerce_before_add_to_cart_button'      => Before "Add To Cart" button
         * 'woocommerce_after_add_to_cart_button'       => After "Add To Cart" button
         * 'woocommerce_after_add_to_cart_form'         => After "Add To Cart" form
         * 'woocommerce_product_additional_information' => After "Additional information"
         *
         * NOTE: can use other woocommerce hooks to insert button in other positions
         */
    
        $settings['woo_btn_position'] = 'woocommerce_after_add_to_cart_button';
      }
    
      return $settings;
    }
    add_filter( 'joinchat_get_settings_site', 'joinchat_woobtn_custom_setting', 10, 2 );
    • This reply was modified 2 years, 4 months ago by Creame.
    • This reply was modified 2 years, 4 months ago by Creame.
    Plugin Author Creame

    (@creapuntome)

    Mark as solved. Please, reopen it if need more help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show only in certain categories // Mostrar sólo en ciertas categorías’ is closed to new replies.