• Resolved bashiachuki

    (@bakoline)


    Hi, I have the below 2 code and how can I make Polylang to move these texts in strings for translation?

    View post on imgur.com

    I mean how to place there pll_ or any other code for your plugin to show it in polylang string translations?

    Here’s my codes

    // Remove Add to Cart, Add View Product Button on product archives(Collection) page
    // First, remove Add to Cart Button
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    // Second, add View Product Button
    add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_view_product_button', 10 );
    function bbloomer_view_product_button() {
    global $product;
    $link = $product->get_permalink();
    echo '<a href="' . $link . '" class="button addtocartbutton">More Details</a>';
    }
    // Add save percent next to sale item prices.
    function ts_you_save() {
        global $product;
         if( $product->is_type('simple') || $product->is_type('external') || $product->is_type('grouped') || $product->is_type( 'woosb' ) ) {
              $regular_price     = get_post_meta( $product->get_id(), '_regular_price', true ); 
              $sale_price     = get_post_meta( $product->get_id(), '_sale_price', true );
               if( !empty($sale_price) ) {
                    $amount_saved = $regular_price - $sale_price;
                    $currency_symbol = get_woocommerce_currency();
                    $percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
                    ?>
                    <p class="save-x-amount">Save: <?php echo number_format($percentage,0, '', '')."%"; ?>
    
                    <?php
              }
         }
      }
      add_action( 'woocommerce_before_add_to_cart_button', 'ts_you_save', 11 );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to use pll__ in these cases?’ is closed to new replies.