Hide Elements when no Information is Returned

API returns a 404 value because the client_id or product_id cannot be found

Product or client ID cannot be found

Symptoms

Pricing information is not displayed on the page, and the affected HTML element is automatically hidden.

Cause

The JavaScript integration receives a 404 Not Found response because the specified client_id or product_id does not exist or cannot be found.

Resolution

Verify that:

  • The client_id is valid.
  • The product_id is valid.
  • Both values match the configured products in Cleverbridge.

When the API returns a 404 response, the integration script automatically adds a CSS class to the affected element and applies display: none to hide it from customers.

Example

When the following CSS class is added:

cleverApi-hide-{product_id}-{property_name}

the integration script applies:

display: none;

For example:

<p class="cleverApi-hide-2-discountAbsolute">
  <label>discountAbsolute:</label>
  <b class="cleverApi cleverApi-2-discountAbsolute"></b>
</p>

<p class="cleverApi-hide-2-discountAbsoluteLocalized">
  <label>discountAbsoluteLocalized:</label>
  <b class="cleverApi cleverApi-2-discountAbsoluteLocalized"></b>
</p>

<p class="cleverApi-hide-2-discountPercentage">
  <label>discountPercentage:</label>
  <b class="cleverApi cleverApi-2-discountPercentage"></b>
</p>

<p class="cleverApi-hide-2-discountPercentageLocalized">
  <label>discountPercentageLocalized:</label>
  <b class="cleverApi cleverApi-2-discountPercentageLocalized"></b>
</p>

Related topics



Did this page help you?