{"id":18725876,"url":"https://github.com/homescriptone/wc-price-js","last_synced_at":"2025-11-11T19:30:19.676Z","repository":{"id":114771484,"uuid":"542177461","full_name":"homescriptone/wc-price-js","owner":"homescriptone","description":"A simple JavaScript function making it easy to convert a number into WooCommerce price.","archived":false,"fork":false,"pushed_at":"2022-09-30T20:42:03.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T15:13:05.237Z","etag":null,"topics":["woocommerce","woocommerce-payments","woocommerce-plugin","woocommerce-price","woocommerce-theme"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/homescriptone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-27T16:13:28.000Z","updated_at":"2022-11-01T20:19:10.000Z","dependencies_parsed_at":"2023-09-16T01:32:12.901Z","dependency_job_id":null,"html_url":"https://github.com/homescriptone/wc-price-js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homescriptone%2Fwc-price-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homescriptone%2Fwc-price-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homescriptone%2Fwc-price-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homescriptone%2Fwc-price-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/homescriptone","download_url":"https://codeload.github.com/homescriptone/wc-price-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239592974,"owners_count":19664855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["woocommerce","woocommerce-payments","woocommerce-plugin","woocommerce-price","woocommerce-theme"],"created_at":"2024-11-07T14:12:23.739Z","updated_at":"2025-11-11T19:30:19.621Z","avatar_url":"https://github.com/homescriptone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Convert a  price in JS in WooCommerce\n\nA simple JavaScript function making it easy to convert a number into WooCommerce price.\n\nIt's based on the code shared by [HelgaTheViking](https://github.com/helgatheviking) in the [WooCommerce Slack Community](https://woocommercecommunity.slack.com/join/shared_invite/zt-1gbkltk7m-mYW~QNTY~GcBCHmngJnK2g)\n\n# How to use it ?  \n-- PHP Code\n```php \n// enqueue the file into the wp website.\nwp_enqueue_script( 'wc-price-js', plugin_dir_url( __FILE__ ) . 'js/wc_price.js', array( 'jquery' ), '1.0', false );\n\n// add inline script to pass currency informations from php to the js.\n$wc_store_object = array(\n  'html' =\u003e true,\n  'currency_symbol' =\u003e get_woocommerce_currency_symbol( get_woocommerce_currency() ),\n  'currency_position' =\u003e get_option( 'woocommerce_currency_pos', true ),\n  'decimal_separator' =\u003e wc_get_price_decimal_separator(),\n  'currency_format_trim_zeros' =\u003e wc_get_price_thousand_separator(),\n  'currency_format_num_decimals' =\u003e wc_get_price_decimals(),\n  'price_format' =\u003e get_woocommerce_price_format(),\n);\nwp_add_inline_script( 'wc-price-js', ' var wc_settings_args=' . wp_json_encode( $wc_store_object ) . ';' );\n\n```\n\n-- JS Code\n```js\nconsole.log( wc_price( 900, wc_settings_args ) ); \n// he will display $ 900 ( based on the currency, the price displayed will be different ).\n\nconsole.log( wc_price( 10, wc_settings_args ) ); \n// he will display 10$ ( based on the currency, the price displayed will be different ).\n\n```\n\n# Credits  \n[Helga The Viking](https://github.com/helgatheviking)  \n[Manu The Blacker](https://github.com/manutheblacker)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomescriptone%2Fwc-price-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhomescriptone%2Fwc-price-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomescriptone%2Fwc-price-js/lists"}