Shortcode
Addonify Floating Cart provides a shortcode that allows you to display the floating cart toggle button anywhere on your website.
[afc_cart_icon id="my-id" class="css-classes" icon="icon_6" display_items_count="true" items_count_position="top-right"]
Print the shortcode content using the do_shortcode function.
<?php
// print the shortcode content.
echo do_shortcode('[afc_cart_icon id="my-id" class="css-classes" icon="icon_6" display_items_count="true" items_count_position="top-right"]');
Following are the shortcode attributes that you can use:
- id: This attribute assigns a unique ID to the cart icon. It can be used for specific styling or JavaScript targeting.
- class: This attribute allows you to add one or more CSS classes to the cart icon. It can be used to apply custom styles defined in your stylesheet.
- icon: This attribute specifies the icon to be used for the cart. You can select the icon value from
icon_1
,icon_2
, …, andicon_8
. - display_items_count: This attribute indicates whether the item count should be displayed with the cart icon. When set to
true
, the item count will be shown. - items_count_position: This attribute specifies the position of the item count relative to the cart icon. You can choose either
top-right
ortop-left
to display the item count at the top-right corner of the icon or at the top-left corner of the icon respectively.