{"id":4622,"date":"2019-02-28T16:37:29","date_gmt":"2019-02-28T05:37:29","guid":{"rendered":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/?p=4622"},"modified":"2019-02-28T21:03:18","modified_gmt":"2019-02-28T10:03:18","slug":"adding-an-id-to-the-add-to-cart-button-of-the-plugin","status":"publish","type":"post","link":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/adding-an-id-to-the-add-to-cart-button-of-the-plugin-4622","title":{"rendered":"Adding an ID to the Add to Cart Button of the Plugin"},"content":{"rendered":"<p>You can add an ID tag to the add to cart button form using the following filter hook of the plugin.<\/p>\n<p>wspsc_add_cart_button_form_attr<\/p>\n<p>Below is an example PHP code that shows you how it works:<\/p>\n<pre>add_filter('wspsc_add_cart_button_form_attr', 'add_cart_button_custom_id');\r\nfunction add_cart_button_custom_id($attr)\r\n{\r\n    $attr .= 'id=\"my_custom_id_123\"';\r\n    return $attr;\r\n}\r\n<\/pre>\n<p>The above example code will add the ID of &#8220;my_custom_id_123&#8221; to the add to cart button form.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can add an ID tag to the add to cart button form using the following filter hook of the plugin. wspsc_add_cart_button_form_attr Below is an example PHP code that shows you how it works: add_filter(&#8216;wspsc_add_cart_button_form_attr&#8217;, &#8216;add_cart_button_custom_id&#8217;); function add_cart_button_custom_id($attr) { $attr .= &#8216;id=&#8221;my_custom_id_123&#8243;&#8216;; return $attr; } The above example code will add the ID of &#8220;my_custom_id_123&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[30],"tags":[24],"class_list":{"0":"post-4622","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-wordpress-shopping-cart","7":"tag-tweaks","8":"entry"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/4622"}],"collection":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/comments?post=4622"}],"version-history":[{"count":0,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/posts\/4622\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/media?parent=4622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/categories?post=4622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/ecommerce\/wp-json\/wp\/v2\/tags?post=4622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}