Title: Buythis Shortcode
Author: Fulfillment.Global
Published: <strong>2021 ལོའི་ཟླ 12 ཚེས 26 ཉིན།</strong>
Last modified: 2025 ལོའི་ཟླ 11 ཚེས 28 ཉིན།

---

མཐུད་སྣེ་བཤེར་འཚོལ།

![](https://ps.w.org/buythis-shortcode/assets/banner-772x250.jpg?rev=2652749)

![](https://ps.w.org/buythis-shortcode/assets/icon.svg?rev=3293944)

# Buythis Shortcode

 རྩོམ་པ་པོ། [Fulfillment.Global](https://profiles.wordpress.org/fulfillmentglobal/)

[ཕབ་ལེན།](https://downloads.wordpress.org/plugin/buythis-shortcode.5.5.zip)

 * [ཞིབ་ཕྲ།](https://bo.wordpress.org/plugins/buythis-shortcode/#description)
 * [གདེང་འཇོག](https://bo.wordpress.org/plugins/buythis-shortcode/#reviews)
 * [ཡར་རྒྱས།](https://bo.wordpress.org/plugins/buythis-shortcode/#developers)

 [རམ་འདེགས།](https://wordpress.org/support/plugin/buythis-shortcode/)

## ཞིབ་བརྗོད།

Buythis.co.za is an online store that specializes in machinery sales.

### Website

Visit [the plugin website](https://buythis.co.za/plugin/shortcode) for online documentation.

### Third party service description

This plugin provides a shortcode to interface between WordPress and [Buythis.co.za](https://buythis.co.za).

This plugin relies on [Buythis.co.za](https://buythis.co.za) as a third party service,
in order for the plugin to work.

The reason for using the third party service, is to access JSON product data from
the [Buythis.co.za](https://buythis.co.za) store.

No personal data is collected during the process.

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 `sku`, `variant`,`
value`, `search`, `format` and `affiliate` shortcode parameters.

No other data of any kind, whatsoever, is used by this plugin, other than the parameters
provided by the user to the plugin shortcode.

The only data currently submitted to the third party service via HTTP is the `sku`
parameter, or the `search` and `format` parameters, depending on which of those 
parameters are explicitly provided to the shortcode.

Links to the third party service:

[https://buythis.co.za](https://buythis.co.za)
 [https://data.buythis.co.za](https://data.buythis.co.za)
[Data definition](https://stoplight.io/api/v1/projects/fulfillment/fulfillment-codes-database/nodes/Models/product.v1.json)

AWS S3 is used to serve cached data when one of the above primary third party service
data sources are not available.

Data received by the plugin via HTTP, is cached in the site’s local WordPress database,
and deleted again when the plugin is uninstalled.

Third party services’ terms of use and privacy policies:

[https://buythis.co.za/terms](https://buythis.co.za/terms)
 [https://buythis.co.za/privacy](https://buythis.co.za/privacy)

### Usage

To use the Buythis Shortcode plugin:

    ```
    [buythis sku="sku" variant="variant" value="path" affiliate="affiliate_id"]
    ```

or

    ```
    [buythis sku="sku" variant="variant" value="path" affiliate="affiliate_id"][/buythis]
    ```

The provided **_affiliate\_id_** is used to generate revenue for a given affiliate,
by using this plugin’s `[buythis]` shortcode on their WordPress site.

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 `affiliate` 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 `affiliate` parameter in each usage
of the shortcode.

Depending on the **_path_** specified in the `value` parameter, one or more API 
calls will be made to the following endpoints (sources), where **_[sku]_** is the
provided `sku` parameter:

>  Source
>  Endpoint URL Example `value` parameter
>  data
>  `https://data.buythis.co.za/product/[sku].json` `data.name.full`
>  display
>  `https://data.buythis.co.za/product/[sku]/display.json` `display.content`
>  price
>  `https://data.buythis.co.za/product/[sku]/price.json` `price.2024-01-01.
> sale`
>  other
>  Dynamic fixed data `other.affiliate`

The API response from a source is JSON-decoded, and the **_path_** specified by 
the `value` parameter is extracted from the JSON response.

Thus, to extract custom JSON data from a source’s API response, use a custom **_path_**
in the `value` parameter to specify (describe) the source API and the JSON data 
to extract from it, as shown in each example `value` parameter above.

### Product listing usage

    ```
    [buythis search="RDWorks_Upgrade" format="cart"]

    [buythis search="sku1, sku2, sku3" format="list"]

    [buythis search="sku1|sku2.variant sku3" format="table1"]
    ```

An HTML-formatted table of products will be generated, as per the specified `format`
parameter, and any product whose SKU matches either **_RDWorks\_Upgrade_**, **_sku1_**,**
_sku2_**, **_sku2.variant_**, or **_sku3_**, will be displayed in the generated 
table.

Generated listing table format definitions:

>  Table format
>  Generated table column headers
>  cart
>  Select, Image, SKU (and Name), Price, Quantity
>  list
>  Image, Description, Price (incl), Buy
>  table1
>  Image, SKU, Description, Price (VAT Incl.), Buy

### Usage with WordPress Ajax

To render `[buythis sku="sku" variant="variant" value="price" search="search" format
="format" affiliate="affiliate_id"][/buythis]` dynamically using jQuery:

> jQuery.post(
 > ‘/wp-admin/admin-ajax.php’, > { > action: ‘buythis_shortcode_ajax’,
> _ajax_nonce: ”, > sku: ‘sku’, > variant: ‘variant’, > value: ‘price’, > search:‘
search’, > format: ‘format’, > affiliate: ‘affiliate_id’ > }, > data => data && 
jQuery( ‘#buythis_plugin_content’ ).html( data ) > ); >

### Shortcuts

The following shortcut `value` options are available:

> | Shortcut | Substituted path (`value` parameter) |
>  |—————–|———————————————————————————————————-
> | | `buy` | `<a href="https://buythis.co.za/(display.slug)#(other.affiliate),cart,
> 1,(other.variant)` | | `content` | `display.content` | | `link` | `https://buythis.
> co.za/(display.slug)#(other.affiliate)` | | `link_name` | `<a href="https://buythis.
> co.za/(display.slug)#(other.affiliate)">(data.name.full|data.name.simple)</a>`
> | | `name` | `data.name.full|data.name.simple` | | `price` | `R (data.price.sale
> |data.price.regular)` | | `regular_price` | `R (data.price.regular|data.price.
> sale)` | | `sale_price` | `R (data.price.sale|data.price.regular)` |
> 
> ### Syntax
> 
>  In order of precedence:

 1. `()` (round braces) is used to treat a **_path_** as a format string, by only evaluating**
    _sub-paths_** 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 **_sub-path_**
    cannot contain a format string. Round braces can contain shortcuts as **_sub-paths_**.
 2. `|` (OR) is to coalesce the first non-null result of a **_sub-path_** out of a 
    set of **_path_** expressions. A **_sub-path_** can be a shortcut, but cannot contain
    round braces.
 3. `.` (period) is the JSON separator in a **_path_**.

## FAQ

Is this plugin free to use?

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.

## གདེང་འཇོག

![](https://secure.gravatar.com/avatar/5858966d06122595233ef7c418123681b009eb0c2d9e717be3ef056a3b90eb1f?
s=60&d=retro&r=g)

### 󠀁[Simply Works.](https://wordpress.org/support/topic/simply-works-251/)󠁿

 [Pieter Brink](https://profiles.wordpress.org/aroundcorporation/) 2022 ལོའི་ཟླ 
2 ཚེས 23 ཉིན།

Works as described. Super handy for keeping my affiliate posts up-to-date. Thanks.

 [ གདེང་འཇོག 1 ཡོངས་སུ་ཀློག ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/)

## བྱས་རྗེས་འཇོག་མཁན། & གསར་འབྱེད་པ།

“Buythis Shortcode” is open source software. The following people have contributed
to this plugin.

བྱས་རྗེས་འཇོག་མཁན།

 *   [ Fulfillment.Global ](https://profiles.wordpress.org/fulfillmentglobal/)

[ཁྱེད་ཀྱི་སྐད་ཡིག་ནང་ལ་ “Buythis Shortcode” ཡིག་སྒྱུར་བྱོས།](https://translate.wordpress.org/projects/wp-plugins/buythis-shortcode)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/buythis-shortcode/),
check out the [SVN repository](https://plugins.svn.wordpress.org/buythis-shortcode/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/buythis-shortcode/)
by [RSS](https://plugins.trac.wordpress.org/log/buythis-shortcode/?limit=100&mode=stop_on_copy&format=rss).

## ཟུར་བརྗོད།

 *  Version **5.5**
 *  Last updated **ཟླ 4  སྔོན།**
 *  Active installations **20+**
 *  WordPress version ** 5.2 ཡང་ན་དེ་ལས་མཐོ་བ། **
 *  Tested up to **6.9.4**
 *  PHP version ** 7.2 ཡང་ན་དེ་ལས་མཐོ་བ། **
 *  Language
 * [English (US)](https://wordpress.org/plugins/buythis-shortcode/)
 *  [མཐོ་རིམ་མཐོང་སྣང་།](https://bo.wordpress.org/plugins/buythis-shortcode/advanced/)

## གདེང་འཇོག

 5 out of 5 stars.

 *  [  1 5-star review     ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/buythis-shortcode/reviews/?filter=1)

[ངའི་མཆན་ཁ་སྣོན།](https://wordpress.org/support/plugin/buythis-shortcode/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/buythis-shortcode/reviews/)

## བྱས་རྗེས་འཇོག་མཁན།

 *   [ Fulfillment.Global ](https://profiles.wordpress.org/fulfillmentglobal/)

## རམ་འདེགས།

Got something to say? Need help?

 [རམ་འདེགས་གླེང་སྟེགས་ལ་ལྟ།](https://wordpress.org/support/plugin/buythis-shortcode/)

## ཞལ་འདེབས།

Would you like to support the advancement of this plugin?

 [ མཐུད་སྣེ་འདི་ལ་ཞལ་འདེབས། ](https://buythis.co.za/)