This website uses cookies to remember you and improve your experience. For more info see our Privacy Policy.

  • About
  • Websites
    • Business Websites
    • Author Websites
  • SEO
  • Portfolio
    • Author Web Design
    • Business Web Design
    • Custom Graphics
    • Logos
  • Services & Pricing
    • Author Website Packages
    • Website Hosting
    • Page Speed Optimization
    • SEO
    • Local SEO
  • MyBookTable
    • MyBookTable Support
  • Contact
  • Hire Us

Mobile Menu

  • Menu
  • Skip to right header navigation
  • Skip to main content

Stormhill Media

Custom websites for every type of business

Header Right

  • About
  • Websites
    • Business Websites
    • Author Websites
  • SEO
  • Portfolio
    • Author Web Design
    • Business Web Design
    • Custom Graphics
    • Logos
  • Services & Pricing
    • Author Website Packages
    • Website Hosting
    • Page Speed Optimization
    • SEO
    • Local SEO
  • MyBookTable
    • MyBookTable Support
  • Contact
  • Hire Us

Customizing Buy Button Editors

Home » Developer Resources » Customizing Buy Button Editors

The mbt_buybutton_editor filter allows you to modify or override the default Buy Button editor. Generally this is done on a per-store basis, but it can also be used to globally change all the editors.
The filter provides four arguments:

$output: The overall editor HTML that will be displayed.

$data: The data for the Buy Button that you are editing.

$id: The ID for this Buy Button.

$store: The data for the store that the Buy Button is using. (See Creating and Modifying Stores)

The $data variable will contain whatever data that the Buy Button editor saves in it, but the default Buy Button data that is used in the plugin is:

store: The slug of the store that the Buy Button uses. (required)

url: The product page URL that the Buy Button will link to. (required for default display)

display: The display type. Possible values are: book_only, featured, and text_only (required for default display)

The $id variable is a special identifier that is used to identify the tags for a particular Buy Button. The saving of all Buy Button information is handled automatically, where the sub-variables for each $id are saved into that Buy Button’s data array. For example, if your Buy Button ID happened to be buybutton1 and you wanted to save a custom variable called button_size into your Buy Button data, you would want to add an tag to the editor that had name = “buybutton1[button_size]”. You could then use this data elsewhere to change how the Buy Button displays. (See Customizing Buy Buttons)
Example:
function change_my_buybutton_editor($output, $data, $id, $store) {
if($data[‘type’] == ‘my_store’) {
$editor = ‘‘;
$editor .= ‘‘;
$editor .= ‘

Paste in the product URL for this item.

‘;
}
return $output;
}
add_filter(‘mbt_buybutton_editor’, ‘change_my_buybutton_editor’, 10, 4);

« Previous
Next »

Site Footer

Quick Links:

  • Contact Us
  • Pricing & Services
  • Sitemap
  • Terms/Conditions
  • Privacy Policy
  • Business Websites
  • Author Websites
  • SEO Services
(903) 213-5266‬

Copyright © 2025 · Stormhill Media All Rights Reserved.
Website by Stormhill Media
Log in