我正在研究从Woocommerce @Path("/test")
public class TestClass {
public static final String RESP_CD_OK = "200";
public static final String RESP_CD_ACCEPTED = "202";
public static final String RESP_CD_ERROR = "500";
public static final String RESP_CD_SERVER_ERROR = "503";
public static final String RESPONSE_CD = "response_cd";
public static final String RESPONSE_MESSAGE = "response_msg";
/**
* Default constructor.
*/
public TestClass() {
}
/**
*
* @param foJSONObject
* @return
*/
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/add")
public JSONObject addNumbers(JSONObject foJSONObject) {
long llNo1;
long llNo2;
JSONObject loResJSONObject = new JSONObject();
try {
llNo1 = (Long) foJSONObject.get("Number1");
llNo2 = (Long) foJSONObject.get("Number2");
long llResult = llNo1 + llNo2;
loResJSONObject.put(RESPONSE_CD, RESP_CD_OK);
loResJSONObject.put("Result", llResult);
loResJSONObject.put(RESPONSE_MESSAGE, "Numbers added successfully");
} catch (Exception loException) {
loException.printStackTrace();
loResJSONObject.put(RESPONSE_CD, RESP_CD_ERROR);
loResJSONObject.put("Result", "-1");
loResJSONObject.put(RESPONSE_MESSAGE,
"Error: While adding numbers: " + loException.getMessage());
}
return loResJSONObject;
}
}
和products
页面中删除不需要的JavaScript的方法。
Wordpress有一个插件Plugin Organizer,用于从WP页面中删除脚本,但它不能处理Woocommerece。
答案 0 :(得分:0)
找到答案。实际上在同一个插件中,它可以选择为Woocommerce启用它。转到管理菜单中的设置 - >插件管理器,并在自定义帖子类型框中启用该帖子类型。这就是全部