{"id":151475,"date":"2021-12-26T21:16:39","date_gmt":"2021-12-26T21:16:39","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/buythis-shortcode\/"},"modified":"2025-11-28T06:45:50","modified_gmt":"2025-11-28T06:45:50","slug":"buythis-shortcode","status":"publish","type":"plugin","link":"https:\/\/hy.wordpress.org\/plugins\/buythis-shortcode\/","author":20114227,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"5.5","stable_tag":"5.5","tested":"6.9.4","requires":"5.2","requires_php":"7.2","requires_plugins":null,"header_name":"Buythis Shortcode","header_author":"Fulfillment Global Corporation","header_description":"This plugin provides an interface between Wordpress and Buythis.co.za","assets_banners_color":"edc00c","last_updated":"2025-11-28 06:45:50","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/buythis.co.za\/","header_plugin_uri":"https:\/\/buythis.co.za\/plugin\/shortcode","header_author_uri":"https:\/\/fulfillment.global\/","rating":5,"author_block_rating":0,"active_installs":20,"downloads":69623,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","faq"],"tags":{"5.5":{"tag":"5.5","author":"fulfillmentglobal","date":"2025-11-28 06:45:50"}},"upgrade_notice":{"":"<p>No upgrade notice at present.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":1},"assets_icons":{"icon-128x128.jpg":{"filename":"icon-128x128.jpg","revision":3293944,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.jpg":{"filename":"icon-256x256.jpg","revision":3293944,"resolution":"256x256","location":"assets","locale":""},"icon.svg":{"filename":"icon.svg","revision":3293944,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":2652749,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":2652749,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["5.5"],"block_files":[],"assets_screenshots":[],"screenshots":{"1":"No screenshots at present."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[206241],"plugin_category":[],"plugin_contributors":[206242],"plugin_business_model":[],"class_list":["post-151475","plugin","type-plugin","status-publish","hentry","plugin_tags-buythis","plugin_contributors-fulfillmentglobal","plugin_committers-fulfillmentglobal"],"banners":{"banner":"https:\/\/ps.w.org\/buythis-shortcode\/assets\/banner-772x250.jpg?rev=2652749","banner_2x":"https:\/\/ps.w.org\/buythis-shortcode\/assets\/banner-1544x500.jpg?rev=2652749","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/buythis-shortcode\/assets\/icon.svg?rev=3293944","icon":"https:\/\/ps.w.org\/buythis-shortcode\/assets\/icon.svg?rev=3293944","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Buythis.co.za is an online store that specializes in machinery sales.<\/p>\n\n<h3>Website<\/h3>\n\n<p>Visit <a href=\"https:\/\/buythis.co.za\/plugin\/shortcode\">the plugin website<\/a> for online documentation.<\/p>\n\n<h3>Third party service description<\/h3>\n\n<p>This plugin provides a shortcode to interface between WordPress and <a href=\"https:\/\/buythis.co.za\">Buythis.co.za<\/a>.<\/p>\n\n<p>This plugin relies on <a href=\"https:\/\/buythis.co.za\">Buythis.co.za<\/a> as a third party service, in order for the plugin to work.<\/p>\n\n<p>The reason for using the third party service, is to access JSON product data from the <a href=\"https:\/\/buythis.co.za\">Buythis.co.za<\/a> store.<\/p>\n\n<p>No personal data is collected during the process.<\/p>\n\n<p>As can be seen in the plugin's source code, this plugin only uses information that is directly and knowingly provided by the user themselves, i.e. the <code>sku<\/code>, <code>variant<\/code>, <code>value<\/code>, <code>search<\/code>, <code>format<\/code> and <code>affiliate<\/code> shortcode parameters.<\/p>\n\n<p>No other data of any kind, whatsoever, is used by this plugin, other than the parameters provided by the user to the plugin shortcode.<\/p>\n\n<p>The only data currently submitted to the third party service via HTTP is the <code>sku<\/code> parameter, or the <code>search<\/code> and <code>format<\/code> parameters, depending on which of those parameters are explicitly provided to the shortcode.<\/p>\n\n<p>Links to the third party service:<\/p>\n\n<p><a href=\"https:\/\/buythis.co.za\">https:\/\/buythis.co.za<\/a>\n<a href=\"https:\/\/data.buythis.co.za\">https:\/\/data.buythis.co.za<\/a>\n<a href=\"https:\/\/stoplight.io\/api\/v1\/projects\/fulfillment\/fulfillment-codes-database\/nodes\/Models\/product.v1.json\">Data definition<\/a><\/p>\n\n<p>AWS S3 is used to serve cached data when one of the above primary third party service data sources are not available.<\/p>\n\n<p>Data received by the plugin via HTTP, is cached in the site's local WordPress database, and deleted again when the plugin is uninstalled.<\/p>\n\n<p>Third party services' terms of use and privacy policies:<\/p>\n\n<p><a href=\"https:\/\/buythis.co.za\/terms\">https:\/\/buythis.co.za\/terms<\/a>\n<a href=\"https:\/\/buythis.co.za\/privacy\">https:\/\/buythis.co.za\/privacy<\/a><\/p>\n\n<h3>Usage<\/h3>\n\n<p>To use the Buythis Shortcode plugin:<\/p>\n\n<pre><code>[buythis sku=\"sku\" variant=\"variant\" value=\"path\" affiliate=\"affiliate_id\"]\n<\/code><\/pre>\n\n<p>or<\/p>\n\n<pre><code>[buythis sku=\"sku\" variant=\"variant\" value=\"path\" affiliate=\"affiliate_id\"][\/buythis]\n<\/code><\/pre>\n\n<p>The provided <strong><em>affiliate_id<\/em><\/strong> is used to generate revenue for a given affiliate, by using this plugin's <code>[buythis]<\/code> shortcode on their WordPress site.<\/p>\n\n<p>A site-wide default Affiliate ID can be configured on the Buythis Shortcode settings page, that will be used as a fallback value for the <code>affiliate<\/code> parameter, should one not be provided. This makes it easy to change the affiliate ID for a site, and prevents the need to duplicate and maintain the <code>affiliate<\/code> parameter in each usage of the shortcode.<\/p>\n\n<p>Depending on the <strong><em>path<\/em><\/strong> specified in the <code>value<\/code> parameter, one or more API calls will be made to the following endpoints (sources), where <strong><em>[sku]<\/em><\/strong> is the provided <code>sku<\/code> parameter:<\/p>\n\n<blockquote>\n  \n  \n  \n    Source\n    Endpoint URL\n    Example <code>value<\/code> parameter\n  \n  \n  \n  \n    data\n    <code>https:\/\/data.buythis.co.za\/product\/[sku].json<\/code>\n    <code>data.name.full<\/code>\n  \n  \n    display\n    <code>https:\/\/data.buythis.co.za\/product\/[sku]\/display.json<\/code>\n    <code>display.content<\/code>\n  \n  \n    price\n    <code>https:\/\/data.buythis.co.za\/product\/[sku]\/price.json<\/code>\n    <code>price.2024-01-01.sale<\/code>\n  \n  \n    other\n    Dynamic fixed data\n    <code>other.affiliate<\/code>\n  \n  \n  \n<\/blockquote>\n\n<p>The API response from a source is JSON-decoded, and the <strong><em>path<\/em><\/strong> specified by the <code>value<\/code> parameter is extracted from the JSON response.<\/p>\n\n<p>Thus, to extract custom JSON data from a source's API response, use a custom <strong><em>path<\/em><\/strong> in the <code>value<\/code> parameter to specify (describe) the source API and the JSON data to extract from it, as shown in each example <code>value<\/code> parameter above.<\/p>\n\n<h3>Product listing usage<\/h3>\n\n<pre><code>[buythis search=\"RDWorks_Upgrade\" format=\"cart\"]\n\n[buythis search=\"sku1, sku2, sku3\" format=\"list\"]\n\n[buythis search=\"sku1|sku2.variant sku3\" format=\"table1\"]\n<\/code><\/pre>\n\n<p>An HTML-formatted table of products will be generated, as per the specified <code>format<\/code> parameter, and any product whose SKU matches either <strong><em>RDWorks_Upgrade<\/em><\/strong>, <strong><em>sku1<\/em><\/strong>, <strong><em>sku2<\/em><\/strong>, <strong><em>sku2.variant<\/em><\/strong>, or <strong><em>sku3<\/em><\/strong>, will be displayed in the generated table.<\/p>\n\n<p>Generated listing table format definitions:<\/p>\n\n<blockquote>\n  \n  \n  \n    Table format\n    Generated table column headers\n  \n  \n  \n  \n    cart\n    Select, Image, SKU (and Name), Price, Quantity\n  \n  \n    list\n    Image, Description, Price (incl), Buy\n  \n  \n    table1\n    Image, SKU, Description, Price (VAT Incl.), Buy\n  \n  \n  \n<\/blockquote>\n\n<h3>Usage with WordPress Ajax<\/h3>\n\n<p>To render <code>[buythis sku=\"sku\" variant=\"variant\" value=\"price\" search=\"search\" format=\"format\" affiliate=\"affiliate_id\"][\/buythis]<\/code> dynamically using jQuery:<\/p>\n\n<blockquote>\n  \n<\/blockquote>\n\n\n\n<blockquote>\n  \n<\/blockquote>\n\n\n&gt;     jQuery.post(\n&gt;         '\/wp-admin\/admin-ajax.php',\n&gt;         {\n&gt;             action:      'buythis_shortcode_ajax',\n&gt;             _ajax_nonce: '',\n&gt;             sku:         'sku',\n&gt;             variant:     'variant',\n&gt;             value:       'price',\n&gt;             search:      'search',\n&gt;             format:      'format',\n&gt;             affiliate:   'affiliate_id'\n&gt;         },\n&gt;         data =&gt; data &amp;&amp; jQuery( '#buythis_plugin_content' ).html( data )\n&gt;     );\n&gt; \n\n<h3>Shortcuts<\/h3>\n\n<p>The following shortcut <code>value<\/code> options are available:<\/p>\n\n<blockquote>\n  <p>| Shortcut        | Substituted path (<code>value<\/code> parameter)                                                                     |\n  |-----------------|----------------------------------------------------------------------------------------------------------|\n  | <code>buy<\/code>           | <code>&lt;a href=\"https:\/\/buythis.co.za\/(display.slug)#(other.affiliate),cart,1,(other.variant)<\/code>                 |\n  | <code>content<\/code>       | <code>display.content<\/code>                                                                                        |\n  | <code>link<\/code>          | <code>https:\/\/buythis.co.za\/(display.slug)#(other.affiliate)<\/code>                                                 |\n  | <code>link_name<\/code>     | <code>&lt;a href=\"https:\/\/buythis.co.za\/(display.slug)#(other.affiliate)\"&gt;(data.name.full|data.name.simple)&lt;\/a&gt;<\/code> |\n  | <code>name<\/code>          | <code>data.name.full|data.name.simple<\/code>                                                                        |\n  | <code>price<\/code>         | <code>R (data.price.sale|data.price.regular)<\/code>                                                                 |\n  | <code>regular_price<\/code> | <code>R (data.price.regular|data.price.sale)<\/code>                                                                 |\n  | <code>sale_price<\/code>    | <code>R (data.price.sale|data.price.regular)<\/code>                                                                 |<h3>Syntax<\/h3>\n  In order of precedence:<\/p>\n<\/blockquote>\n\n<ol>\n<li><code>()<\/code> (round braces) is used to treat a <strong><em>path<\/em><\/strong> as a format string, by only evaluating <strong><em>sub-paths<\/em><\/strong> in the format string that are contained within round braces, and leaving text in the rest of the format string that are outside round braces, intact. Nested braces, i.e. braces inside braces, are not supported, i.e. a <strong><em>sub-path<\/em><\/strong> cannot contain a format string. Round braces can contain shortcuts as <strong><em>sub-paths<\/em><\/strong>.<\/li>\n<li><code>|<\/code> (OR) is to coalesce the first non-null result of a <strong><em>sub-path<\/em><\/strong> out of a set of <strong><em>path<\/em><\/strong> expressions. A <strong><em>sub-path<\/em><\/strong> can be a shortcut, but cannot contain round braces.<\/li>\n<li><code>.<\/code> (period) is the JSON separator in a <strong><em>path<\/em><\/strong>.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<p>Is this plugin free to use?<\/p>\n\n<p>Yes, this plugin is free to use. The source code is also available for you to examine what the plugin does and how it works.<\/p>","raw_excerpt":"Buythis Shortcode","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/151475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=151475"}],"author":[{"embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/fulfillmentglobal"}],"wp:attachment":[{"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=151475"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=151475"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=151475"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=151475"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=151475"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/hy.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=151475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}