WooCommerce 文档

title: "WooCommerce 插件 API 回调" post_status: publish comment_status: open taxonomy: category: - woocommerce post_tag: - Core Concepts - Extensions - Repos


WooCommerce 插件 API 回调

概述

文档 提供了关于如何使用 WooCommerce 插件 API 来发起插件 操作,特别是对于默认情况下未初始化的 网关 的指南。

回调 网址 结构

在 WooCommerce 2.0 之前,使用:

https://example.com/?wc-api=CALLBACK

在 WooCommerce 2.0 或更高版本中,使用以下端点:

https://example.com/wc-api/CALLBACK/

行为

访问 回调 网址 时,WooCommerce 将:

接入 API 回调

要接入回调,请在您的插件中添加一个 钩子

add_action( 'woocommerce_api_callback', 'your_callback_handler_function' );

回调后的重定向

可以使用您的自定义 句柄 函数在 操作 执行完成后将用户 重定向