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 Buttons

Home » Developer Resources » Customizing Buy Buttons

There are two primary ways of modifying how Buy Buttons display, the mbt_filter_buybutton_data filter, which allows you to temporarily modify the Buy Button’s data before it is displayed, and the mbt_format_buybutton filter, which lets you filter the entire button output.

Filtering Buy Button Data
The mbt_filter_buybutton_data filter works on each Buy Button’s $data variable, and can also provide the $store information that the Buy Button uses if you set the accepted_args variable in add_filter to 2.
The $data variable will contain whatever data that the Buy Button editor saved 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)

Example:
function filter_my_buybutton_data($data, $store) {
if($data[‘store’] == ‘my_store’) {
$data[‘url’] = my_store_custom_url($data[‘url’]);
}
return $data;
}
add_filter(‘mbt_filter_buybutton_data’, ‘filter_my_buybutton_data’, 10, 2);

Overriding Buy Button Output
By default, MyBookTable looks in your currently selected Style Pack for an image to display for your store. To do this it searches for an image called _button.png. So for example, the Amazon Buy Button image would be named amazon_button.png in the Style Pack. You can override this image by creating a Custom Style Folder, or you can completely change the functionality of how your Buy Button is output using the filter below.
Using the mbt_format_buybutton filter sometimes requires you to write more code, but it allows you to change any aspect of how your Buy Button displays or even completely replace it with your own output.
Example:
function format_my_buybutton($output, $data, $store) {
if($data[‘store’] == ‘my_store’) {
$output = ““.$output.”“; //Please don’t actually do this
}
return $output;
}
add_filter(‘mbt_format_buybutton’, ‘format_my_buybutton’, 10, 3);

« 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