How can I remove a pair of () from my savings text box

Solved
RobMoore007
Explorer
122 1 12

Screen Shot 2021-05-18 at 19.36.31.pngI have () inside my savings text box and I wish to remove / hide them please. See screenshot

The () appear in the attached JS code

 

 if (variant && variant.available == true) {
    if (variant.price < variant.compare_at_price) {
      $('.was-price', $product).html('<span class="money">' + Shopify.formatMoney(variant.compare_at_price, $('body').data('money-format')) + '</span>');
      $('.savings', $product).html(Shopify.translation.product_savings + ' ' + parseInt((variant.compare_at_price - variant.price) * 100 / variant.compare_at_price) + '% (' + '<span class="money">' + Shopify.formatMoney(variant.compare_at_price - variant.price, $('body').data('money-format')) + '</span>)');
      $('.current_price', $product).parent().addClass('sale');
    } else {
      $('.was-price', $product).html('');
      $('.savings', $product).html('');
      $('.current_price', $product).parent().removeClass('sale');
    }
  

    if (variant.inventory_management && variant.inventory_quantity > 0) {
      if (Shopify.theme_settings.display_inventory_left) {
        var items_left_text = Shopify.translation.product_count_other;

        if (variant.inventory_quantity == 1) {
          items_left_text = Shopify.translation.product_count_one;
        }

        var inventoryThreshold = Shopify.theme_settings.inventory_threshold;

        if (variant.inventory_quantity <= inventoryThreshold) {
          $('.items_left', $product).html(variant.inventory_quantity + " " + items_left_text);
        } else {
          $('.items_left', $product).html("");
        }
      }

      if (variant.inventory_policy == "deny") {
        $('[data-max-inventory-management]', $product).attr('max', variant.inventory_quantity); // Check to see if quantity selector should be disabled based on inventory remaining

        Shopify.theme.quantityBox.updateQuantityControls($productFormInput);
      }
    } else {
      $('.items_left', $product).text('');
      $('[data-max-inventory-management]', $product).removeAttr('max');
    }

    $('.sold_out', $product).text('');
    $('.cart-warning', $product).text('');

    if (variant.price > 0) {
      $('.current_price', $product).html('<span class="money">' + Shopify.formatMoney(variant.price, $('body').data('money-format')) + '</span>');
    } else {
      $('.current_price', $product).html(Shopify.translation.free_price_text);
    }

    $('[data-add-to-cart-trigger]', $product).removeClass('disabled').removeAttr('disabled').find('span:not(.icon)').text($('[data-add-to-cart-trigger]', $product).data('label'));
    $('.shopify-payment-button', $product).show();
    $('.purchase-details__quantity', $product).show();
    $notify_form.hide();
    $notifyFormInputs.empty();
    $notifyFormInputs.append(notifyFormHTML);

    if (Currency.show_multiple_currencies) {
      Shopify.theme.currencyConverter.convertCurrencies();
    }
  } else {
    var message = variant ? Shopify.translation.soldOut : Shopify.translation.unavailable;
    $('.was-price', $product).text('');
    $('.savings', $product).text(''); 
    $('.current_price', $product).text('');
    $('.items_left', $product).text('');
    $('[data-max-inventory-management]', $product).removeAttr('max');
    $('.sold_out', $product).text(message);
    $('[data-add-to-cart-trigger]', $product).addClass('disabled').attr('disabled', 'disabled').find('span:not(.icon)').text(message);
    $('.shopify-payment-button', $product).hide();
    $('.purchase-details__quantity', $product).hide();
    $notify_form.hide();
    $notifyFormInputs.empty();

    if (variant && !variant.available) {
      $notify_form.fadeIn();
      $notifyFormInputs.empty();
      $notifyFormInputs.append(notifyFormHTML);
    }
  }
};

 

Regards
Rob Moore - NEWBY!!
dmwwebartisan
Shopify Partner
6444 1497 1955

@RobMoore007 

I think this is the code for brackets.

for-bracket.jpg

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
0 Likes
RobMoore007
Explorer
122 1 12

Removing this also removes everything before it (eg 11%) . All I want to remove are the 2 x () ?

Regards
Rob Moore - NEWBY!!
dmwwebartisan
Shopify Partner
6444 1497 1955

This is an accepted solution.

@RobMoore007 

If you check the above code after "%" sign there is a "(" bracket. So from this bracket to "</span>)" this closing span and closing round bracket, you must delete up to this.

So it will remove only bracket. Hope this helps.

Thanks!

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
0 Likes
RobMoore007
Explorer
122 1 12

Hi there, I did the deletion as you described and it removed all navigation links to mega-menus and removed the carosel in my home page?

Regards
Rob Moore - NEWBY!!
0 Likes
dmwwebartisan
Shopify Partner
6444 1497 1955

@RobMoore007 

It is not possible. This is not the navigation and carousel code.

Please check the code properly and try to remove it.

 

If helpful then please Like and Accept Solution | Email: dmw.webartisan@gmail.com | Instagram: @dmw.webartisan
Check here PageFly App to customize your pages | Bag is a cart drawer that maximizes your sales. View app →
0 Likes
RobMoore007
Explorer
122 1 12

Many thanks for your help on this one..It worked

Regards
Rob Moore - NEWBY!!
RobMoore007
Explorer
122 1 12

Thanks again for all your valuable help!

I want to hide this sale savings box when it does not have any content or is 0% ... This is the code from products_main.liquid

        {% comment %} Savings {% endcomment %}
              {% if section.settings.display_savings %}
            <span class="sale savings">
                  {% if variant.price < variant.compare_at_price and variant.available %}
                    {{ 'products.product.savings' | t }}  {{ variant.compare_at_price | minus: variant.price | times: 100 | divided_by: variant.compare_at_price }}% </span>
               {% endif %}
                </span>
              {% endif %}

               </span>

 

Regards
Rob Moore - NEWBY!!
0 Likes