How to add buy now buttons to WordPress audio player


WordPress Audio Player


Can you put a "buy now" button on each song that we can set a URL where people can purchase that song or playlist?


Please note, this answer only adds required buy now links to the audio player. The plugin does not include a shopping cart function and it's your own responsibility to integrate the buy now links to your shopping cart.

In the plugin, step 3, Options tab, Advanced Options, add the following text to the Advanced Options box:

data-tracklistitemformat="%ID%. %TITLE% <span style='float:right;'><a href=''>Buy Now</a></span>"

In the above text, the %ID%, %TITLE% are pre-defined macro variables supported by the plugin. They will be dynamically replaced when the player is rendered.

The text <a href=''>Buy Now</a> defines the Buy Now link. The %ID% in the href value will be dynamically replaced by the current audio id. When the player is rendered, the Buy Now link for each audio will be:

In your checkout page (in this tutorial, it's, you need to check the value of parameter id, and add the corresponding audio to your shopping cart. Please make sure to change the URL to your own checkout page.

The CSS span style will move the Buy Now link to the right of the play list.