This flow compresses the entire journey from package selection to payment into a single step, completely bypassing the default WooCommerce cart and checkout process.
How It Works in Init Manga
The core logic is handled by the init_manga_rest_buy_coin function, which branches into two distinct flows:
- Checkout Flow (default): Add to cart → redirect to checkout page
- Auto Order Flow: Create order instantly → trigger payment gateway → redirect to payment
The switching mechanism between these flows is controlled via internal filters provided by the theme.
Enable Auto Order Flow
To activate the low-friction flow, add the following filter:
add_filter('init_manga_topup_auto_create_order', '__return_true');
Once enabled, Init Manga will:
- Skip cart and checkout entirely
- Create the order programmatically using
wc_create_order() - Directly invoke
process_payment()from the selected gateway - Return a redirect URL for immediate frontend navigation
Prioritize Your Preferred Gateway
Init Manga uses the init_manga_pick_payment_gateway() function to select an available gateway. You can override the priority logic to ensure your desired gateway is picked first:
add_filter('init_manga_topup_gateway_candidates', function($gateways) {
// Prioritize sepay gateway
if (isset($gateways['sepay'])) {
return ['sepay' => $gateways['sepay']] + $gateways;
}
return $gateways;
});
This guarantees that the sepay gateway is always selected first when available.
Technical Notes
- Rate limiting: 5-second cooldown between order creations via
_init_last_topup_time - Session handling: Automatically initializes
WC()->cartandWC()->customerif missing - Virtual products only: Ensures no shipping logic is triggered
- Order flagging: Uses
_is_init_manga_topupmeta to identify top-up orders - Safe fallback: Failed gateway initialization marks the order as
failed
When Should You Use This Flow?
- When your system focuses on top-ups or digital products
- When no additional billing information is required
- When you want to maximize payment completion rate
Conclusion
Auto Order Flow in Init Manga is more than a technical optimization — it is a conversion strategy. By removing friction and unnecessary steps, you shorten the path from user intent to completed payment, which is exactly where revenue is generated.
Comments