Title: Trying to customise using javascript
Last modified: July 28, 2021

---

# Trying to customise using javascript

 *  Resolved [Delve](https://wordpress.org/support/users/singhwise/)
 * (@singhwise)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/trying-to-customise-using-javascript/)
 * I’m trying to add some javascript that will hide a div if it contains a particular
   type of text. In thise case if the price is shown as £0.00 I want to hide the
   div using javascript.
 * I’ve noticed this works for any custom div’s that I create, but it fails to work
   for any wp-shopify divs.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftrying-to-customise-using-javascript%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/trying-to-customise-using-javascript/#post-14712358)
 * [@singhwise](https://wordpress.org/support/users/singhwise/) Hey there,
 * It might be due to the plugin’s loading cycle. If you’re running custom JavaScript
   targeting the plugin, you’ll need to place it within the `after.cart.ready` hook,
   like this:
 *     ```
       wp.hooks.addAction('after.cart.ready', 'wpshopify', function (cartState) {
           jQuery('.wps-product-individual-price[data-price="0"]').closest('.wps-item').hide();
       });
       ```
   
 * [https://docs.wpshop.io/#/js/actions/cart?id=aftercartready](https://docs.wpshop.io/#/js/actions/cart?id=aftercartready)
 * Does this help?
 *  Thread Starter [Delve](https://wordpress.org/support/users/singhwise/)
 * (@singhwise)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/trying-to-customise-using-javascript/#post-14714094)
 * I’m having a problem getting that script to load up. When viewing source I can
   see the hook which pulls in the product SKU but not this hook. Even though it’s
   been added into the same file.
 * Not sure what’s going on here..
    -  This reply was modified 4 years, 9 months ago by [Delve](https://wordpress.org/support/users/singhwise/).
 *  Plugin Author [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * (@andrewmrobbins)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/trying-to-customise-using-javascript/#post-14734771)
 * This has been fixed, but for anyone else seeing this thread, try adding this 
   JavaScript to your WP theme:
 *     ```
       `wp.hooks.addAction('after.cart.ready', 'wpshopify', function (cartState) {
   
           var zeroPriceElements = jQuery('.wps-product-individual-price[data-price="0"]');
   
           zeroPriceElements.parent().hide();
   
       });
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Trying to customise using javascript’ is closed to new replies.

 * ![](https://ps.w.org/wpshopify/assets/icon.svg?rev=2740857)
 * [ShopWP](https://wordpress.org/plugins/wpshopify/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpshopify/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpshopify/)
 * [Active Topics](https://wordpress.org/support/plugin/wpshopify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpshopify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpshopify/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [js](https://wordpress.org/support/topic-tag/js/)

 * 3 replies
 * 2 participants
 * Last reply from: [andrewmrobbins](https://wordpress.org/support/users/andrewmrobbins/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/trying-to-customise-using-javascript/#post-14734771)
 * Status: resolved