{"action":"created","comment":{"url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/comments/157159469","pull_request_review_id":83758576,"id":157159469,"diff_hunk":"@@ -0,0 +1,163 @@\n+/* global jQuery, tinyMCE, YoastSEO, window.YoastReplaceVarPlugin.ReplaceVar, wpseoWooReplaceVarsL10n */\n+( function() {\n+\t'use strict';\n+\n+\tvar pluginName = 'replaceWooVariablePlugin';\n+\tvar ReplaceVar = window.YoastReplaceVarPlugin.ReplaceVar;\n+\tvar placeholders = {};\n+\n+\tvar modifiableFields = [\n+\t\t\"content\",\n+\t\t\"title\",\n+\t\t\"snippet_title\",\n+\t\t\"snippet_meta\",\n+\t\t\"primary_category\",\n+\t\t\"data_page_title\",\n+\t\t\"data_meta_desc\",\n+\t];\n+\n+\t/**\n+\t * Calculates the price based on the set price and sale price.\n+\t *\n+\t * @returns {string} The calculated price.\n+\t */\n+\tfunction GetPrice() {\n+\t\tvar regularPrice = parseFloat( jQuery( \"#_regular_price\" ).val() );\n+\t\tvar salePrice = parseFloat( jQuery( \"#_sale_price\" ).val() );\n+\t\tvar price = regularPrice;\n+\n+\t\tif ( salePrice > 0 && salePrice < price ) {\n+\t\t\tprice = regularPrice - salePrice;\n+\t\t}\n+\n+\t\t// Formats the price.\n+\t\tprice = Math.round( price );\n+\t\tprice = price.toFixed( parseInt( wpseoWooReplaceVarsL10n.decimals, 10 ) );\n+\t\tprice = price.toLocaleString( wpseoWooReplaceVarsL10n.locale, { currency: wpseoWooReplaceVarsL10n.currency } );\n+\t\treturn wpseoWooReplaceVarsL10n.currencySymbol + \" \" +  price;\n+\t}\n+\n+\t/**\n+\t * Gets the value of the set short description.\n+\t *\n+\t * @returns {string} The value of the short description.\n+\t */\n+\tfunction GetShortDescription() {\n+\t\tvar productDescription = document.getElementById( 'excerpt' ).value;\n+\t\tif (typeof tinyMCE !== 'undefined' && tinyMCE.get( 'excerpt') !== null) {","path":"js/src/yoastseo-woo-replacevars.js","position":null,"original_position":47,"commit_id":"dfe88419b10637cb9a523cf53178d4f3ec1af5b3","original_commit_id":"6dc45125b4b1cd66ff4f54bfd5cddab8532c3af6","user":{"login":"andizer","id":325040,"avatar_url":"https://avatars0.githubusercontent.com/u/325040?v=4","gravatar_id":"","url":"https://api.github.com/users/andizer","html_url":"https://github.com/andizer","followers_url":"https://api.github.com/users/andizer/followers","following_url":"https://api.github.com/users/andizer/following{/other_user}","gists_url":"https://api.github.com/users/andizer/gists{/gist_id}","starred_url":"https://api.github.com/users/andizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andizer/subscriptions","organizations_url":"https://api.github.com/users/andizer/orgs","repos_url":"https://api.github.com/users/andizer/repos","events_url":"https://api.github.com/users/andizer/events{/privacy}","received_events_url":"https://api.github.com/users/andizer/received_events","type":"User","site_admin":false},"body":"Is processed.","created_at":"2017-12-15T09:49:02Z","updated_at":"2017-12-15T09:49:02Z","html_url":"https://github.com/Yoast/wpseo-woocommerce/pull/159#discussion_r157159469","pull_request_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/comments/157159469"},"html":{"href":"https://github.com/Yoast/wpseo-woocommerce/pull/159#discussion_r157159469"},"pull_request":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159"}},"in_reply_to_id":153209740},"pull_request":{"url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159","id":129573056,"html_url":"https://github.com/Yoast/wpseo-woocommerce/pull/159","diff_url":"https://github.com/Yoast/wpseo-woocommerce/pull/159.diff","patch_url":"https://github.com/Yoast/wpseo-woocommerce/pull/159.patch","issue_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/159","number":159,"state":"open","locked":false,"title":"Add replacement variables","user":{"login":"jdevalk","id":487629,"avatar_url":"https://avatars0.githubusercontent.com/u/487629?v=4","gravatar_id":"","url":"https://api.github.com/users/jdevalk","html_url":"https://github.com/jdevalk","followers_url":"https://api.github.com/users/jdevalk/followers","following_url":"https://api.github.com/users/jdevalk/following{/other_user}","gists_url":"https://api.github.com/users/jdevalk/gists{/gist_id}","starred_url":"https://api.github.com/users/jdevalk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdevalk/subscriptions","organizations_url":"https://api.github.com/users/jdevalk/orgs","repos_url":"https://api.github.com/users/jdevalk/repos","events_url":"https://api.github.com/users/jdevalk/events{/privacy}","received_events_url":"https://api.github.com/users/jdevalk/received_events","type":"User","site_admin":false},"body":"## Summary\r\n\r\nThis PR can be summarized in the following changelog entry:\r\n\r\n* Adds `%%wc_price%%`, `%%wc_sku%%`, `%%wc_shortdesc%%` and `%%wc_brand%%` replacement variables for titles and meta description.\r\n\r\n## Relevant technical choices:\r\n\r\n* Removed duplicate short desc function.\r\n\r\n## Test instructions\r\n\r\nThis PR can be tested by following these steps:\r\n\r\n* Add the above variables to title or meta description template and test output.  The brand one works with the official WooCommerce brands extension or [this one](https://wordpress.org/plugins/perfect-woocommerce-brands/).\r\n\r\nFixes #158","created_at":"2017-07-09T18:21:36Z","updated_at":"2017-12-15T09:49:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0db1a3feb7f9b2a4400d8e42c7443a5c02a02a33","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159/commits","review_comments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159/comments","review_comment_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/159/comments","statuses_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/statuses/dfe88419b10637cb9a523cf53178d4f3ec1af5b3","head":{"label":"Yoast:jdv/replacements","ref":"jdv/replacements","sha":"dfe88419b10637cb9a523cf53178d4f3ec1af5b3","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars0.githubusercontent.com/u/4690436?v=4","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":9305438,"name":"wpseo-woocommerce","full_name":"Yoast/wpseo-woocommerce","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars0.githubusercontent.com/u/4690436?v=4","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/wpseo-woocommerce","description":"This extension to WooCommerce and Yoast SEO makes sure there's perfect communication between the two plugins.","fork":false,"url":"https://api.github.com/repos/Yoast/wpseo-woocommerce","forks_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/forks","keys_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/teams","hooks_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/hooks","issue_events_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/events","assignees_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/tags","blobs_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/languages","stargazers_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/stargazers","contributors_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/contributors","subscribers_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/subscribers","subscription_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/subscription","commits_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/merges","archive_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/downloads","issues_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/releases{/id}","deployments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/deployments","created_at":"2013-04-08T19:56:25Z","updated_at":"2017-12-07T18:13:41Z","pushed_at":"2017-12-12T08:31:04Z","git_url":"git://github.com/Yoast/wpseo-woocommerce.git","ssh_url":"git@github.com:Yoast/wpseo-woocommerce.git","clone_url":"https://github.com/Yoast/wpseo-woocommerce.git","svn_url":"https://github.com/Yoast/wpseo-woocommerce","homepage":"https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/","size":926,"stargazers_count":43,"watchers_count":43,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":41,"license":null,"forks":10,"open_issues":41,"watchers":43,"default_branch":"trunk"}},"base":{"label":"Yoast:trunk","ref":"trunk","sha":"cc56ae5fe51d7360da049cfd5824840ae82459c7","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars0.githubusercontent.com/u/4690436?v=4","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":9305438,"name":"wpseo-woocommerce","full_name":"Yoast/wpseo-woocommerce","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars0.githubusercontent.com/u/4690436?v=4","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/wpseo-woocommerce","description":"This extension to WooCommerce and Yoast SEO makes sure there's perfect communication between the two plugins.","fork":false,"url":"https://api.github.com/repos/Yoast/wpseo-woocommerce","forks_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/forks","keys_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/teams","hooks_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/hooks","issue_events_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/events","assignees_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/tags","blobs_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/languages","stargazers_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/stargazers","contributors_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/contributors","subscribers_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/subscribers","subscription_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/subscription","commits_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/merges","archive_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/downloads","issues_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/releases{/id}","deployments_url":"https://api.github.com/repos/Yoast/wpseo-woocommerce/deployments","created_at":"2013-04-08T19:56:25Z","updated_at":"2017-12-07T18:13:41Z","pushed_at":"2017-12-12T08:31:04Z","git_url":"git://github.com/Yoast/wpseo-woocommerce.git","ssh_url":"git@github.com:Yoast/wpseo-woocommerce.git","clone_url":"https://github.com/Yoast/wpseo-woocommerce.git","svn_url":"https://github.com/Yoast/wpseo-woocommerce","homepage":"https://yoast.com/wordpress/plugins/yoast-woocommerce-seo/","size":926,"stargazers_count":43,"watchers_count":43,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":41,"license":null,"forks":10,"open_issues":41,"watchers":43,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159"},"html":{"href":"https://github.com/Yoast/wpseo-woocommerce/pull/159"},"issue":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/159"},"comments":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/issues/159/comments"},"review_comments":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159/comments"},"review_comment":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/pulls/159/commits"},"statuses":{"href":"https://api.github.com/repos/Yoast/wpseo-woocommerce/statuses/dfe88419b10637cb9a523cf53178d4f3ec1af5b3"}},"author_association":"OWNER"}}
{"actor":{"display_login":"andizer"}}