Skip to content

Instantly share code, notes, and snippets.

View aimahdi's full-sized avatar
🛋️
Working on something bigger

Amimul Ihsan aimahdi

🛋️
Working on something bigger
View GitHub Profile

Custom Checkout Fields & Stripe Processing Fee

This document describes how to add custom checkout fields (Purchase Order Reference & User Note) and a 2.7% credit card processing fee for Stripe payments in FluentCart.

Features

  • Purchase Order Reference Field: Optional text field on checkout
  • User Note Field: Optional textarea for order notes
  • Stripe Processing Fee: 2.7% fee automatically added to Stripe payments only
  • Email Shortcodes: Use {{order.purchase_order_reference}}, {{order.user_note}}, and {{order.processing_fee}} in email templates

Custom Add to Cart Button

This tutorial explains how to create a custom Add to Cart button using FluentCart and how to find the required IDs.


Step 1: Add the Button HTML

Add the following HTML code to any page where you want the button to appear:

<?php
add_filter('fluent_community/can_view_members_page', function ($canView, $pageStatus) {
if (!is_user_logged_in()) {
return false;
}
if (!class_exists('\FluentCart\App\Models\Order')) {
return false;
<?php
add_filter( 'taxonomy_labels_product-categories', function( $labels ) {
$labels->name = 'FluentCartProduct Categories';
$labels->singular_name = 'FluentCartProduct Category';
$labels->menu_name = 'FluentCartProduct Categories';
$labels->all_items = 'All FluentCartProduct Categories';
$labels->edit_item = 'Edit FluentCartProduct Category';
$labels->add_new_item = 'Add New FluentCartProduct Category';
return $labels;
<?php
//Hook name for single order page: fluent_cart/widgets/single_order_page
//Hook name for single customer page: fluent_cart/widgets/customer
//Hook name for single product page: fluent_cart/widgets/single_product_page
add_filter('fluent_cart/widgets/single_product_page', function ($widgets, $customer) {
// 1️⃣ Affiliate form widget (unchanged)
$widgets[] = [
<?php
add_filter('fluent_cart/global_customer_menu_items', function ($items, $context) {
unset($items['downloads']);
return $items;
}, 10, 2);
add_action('template_redirect', function () {
if (is_admin()) {
return;
<?php
add_filter( 'wp_new_user_notification_email', function ( $email, $user, $blogname ) {
$reset_link = wp_lostpassword_url();
$email['subject'] = sprintf(
'Welcome to %s – Set your password',
$blogname
);

Enable Subscription order creation using snippet

add_filter('fluent_cart/order/is_subscription_allowed_in_manual_order', function(){
    return true;
});

API Endpoint: /wp-json/fluent-cart/v2/orders

<?php
add_filter('fluent_cart/single_product/variation_view_type', function ($viewType, $data) {
$textOnlyProducts = [];
$imageOnlyProducts = [];
$bothOnlyProducts = [];
$productId = $data['product']->ID;
if(in_array($productId, $textOnlyProducts)) {
return 'text';
<?php
add_filter('fluent_cart/orders_table_columns', function($columns){
$columns['title_1'] =[
'label' => 'The Custom',
'accessor' => 'iam_custom',
'render_template' => true,
'template' => '<div class="flex gap-2">
{{data.order?.invoice_no || "--"}}